Moving Panels without Changing Their Size
jjweimer
MoveWindow uses points. Panels are dimensioned in pixels. GetWindow returns pixels or points. Points and pixels are related by the screen resolution.
To offset a window by loffset and toffset, for any other (non-panel) window, I would do
GetWindow winname wsize
MoveWindow winname V_left+loffset, V_top+toffset, V_right+loffset, V_bottom+toffset
MoveWindow winname V_left+loffset, V_top+toffset, V_right+loffset, V_bottom+toffset
For a panel, I could do the same, however I am concerned that translations between points <-> pixels might cause the panel to shrink/expand, even if only to an imperceptible degree.
Comments would be appreciated.
Because GetWindow and MoveWindow work with fractional points, you're okay.
Here's a demo that should reassure you: a "drunkard's walk" demo of a moving panel.
Variable iterations= 1000
DoWindow Panel0
if( V_Flag == 0 )
NewPanel/N=Panel0/K=1
endif
fMovePanelAbout(iterations)
End
Function fMovePanelAbout(iterations)
Variable iterations
Variable loffset,toffset, i
for(i=1;i<=iterations;i+=1)
loffset= enoise(3)
toffset= enoise(3)
GetWindow Panel0 wsize
if( i == 1 || i == iterations )
Print i, "width= ", V_right-V_left, ", height=", V_bottom-V_Top
endif
MoveWindow/W=Panel0 V_left+loffset, V_top+toffset, V_right+loffset, V_bottom+toffset
endfor
End
Run the macro and observe the initial and final window sizes. Resize the panel manually (chances are it'll be a fractional point size) and run the demo again.
Software Engineer, WaveMetrics, Inc.
July 2, 2008 at 11:27 am - Permalink
Good to know. I'll modify my ScreenSizer package accordingly to work with fractional points rather than rounded values.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
July 2, 2008 at 12:52 pm - Permalink