Porgrammatically re-size control panel?

Is there a way to programmatically re-size an existing control panel? I have a control panel with radio buttons that evoke functions that cause other controls to appear/disappear from the control panel. I would like these same procedures to resize the control panel so as to fit the new control layout. However, I have not been able to find an Igor function that allows me to change the size of an existing control panel. Is this possible?
Thanks for your reply. Alas, I am having some difficulty making the GetWindow/MoveWindow command sequence work as I would have hoped. The following code snippit is intended to to check if the control panel currently exits and, if so, remember its coordinates. It then deleted the panel and creates a new one with the same coordinates. The code that follows (not shown) then adds controls to the newly created blank panel.

What happens in practice is that each time the code executes the new panel is ~30% smaller (in both directions) than the old one, so the window shrinks. It is as if GetWindow wsize and MoveWindow do not agree on the coordinate units. Any suggestions?

Function DrawStickingPanel()
Variable left, top, right, bottom, height, y0, x0, x1, i
NVAR MSCalibMethod, StickingBLMethod, StickingBLFitType, StickingPolyN, StickingMassSpecCalib
NVAR ZeroStickBLMethod, ZeroStickBLFitType, ZeroStickPolyN
SVAR CalSelect

height = 450

DoWindow StickingPanel
if (V_flag == 1)
GetWindow StickingPanel, wsize
left = V_left
top = V_top
right = V_right
bottom = V_bottom
DoWindow /K StickingPanel
else
left = 10
top = 400
right = 510
bottom = top + height
endif

NewPanel /K=2 /W=(left, top, right, bottom) as "Sticking Measurement"
DoWindow /C/N StickingPanel
...
...
...
In answer to my own question:

It turns out that, for somewhat obscure reasons, the coordinate units used by the NewPanel command are different than those used by MoveWindow and those returned by GetWindow wsize. NewPanel is apparently unique and special in that it uses device pixel coordinates whereas the other commands use "points" (in the typographic sense). Typographic points are 72/inch whereas Igor Pro believes that displays on Windows computers are 96 pixels per inch. Thus one must multiply the results returned by GetWindows wsize by 96/72 to turn them into device pixel coordinates utilizable by NewPanel.

One might think that you could use GetWindow wsizeDC, which is supposed to return "device coordinates". However, this command appears to always report that V_left=0 and V_top=0, as if the window were in the upper left corner of the screen, so the absolute window position is lost.

James Gladden wrote:

What happens in practice is that each time the code executes the new panel is ~30% smaller (in both directions) than the old one, so the window shrinks. It is as if GetWindow wsize and MoveWindow do not agree on the coordinate units. Any suggestions?


You might appreciate the package ScreenSizer here.

http://www.igorexchange.com/project/ScreenSizer

I use it exhaustively for every panel that I create for my own.

FWIW, the internal command ScreenResolution also fixes the problem you mention of converting points and pixels. See the code snippet I posted earlier for the application.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
Quote:
Typographic points are 72/inch whereas Igor Pro believes that displays on Windows computers are 96 pixels per inch. Thus one must multiply the results returned by GetWindows wsize by 96/72 to turn them into device pixel coordinates utilizable by NewPanel.

That 96 is the usual resolution of a Windows screen, but it doesn't have to be 96. Use ScreenResolution to get the actual DPI for your screen, as suggested by JJWeimer.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com