Moving Panels without Changing Their Size

What is the best way programmatically to reposition a panel without changing absolutely anything about its width and height?

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


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.
This is of concern only on Windows where the screen resolution isn't presumed to be 1 pixel = 1 point.

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.

Macro MovePanelAbout()
    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.
JimProuty wrote:
This is of concern only on Windows ... [however because] GetWindow and MoveWindow work with fractional points, you're okay.


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