Retrieve window size for modal panel

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
4 posts • Page 1 of 1
weirdal
Posts:34
Joined: Thu Mar 12, 2015 11:37 am

Retrieve window size for modal panel

Post by weirdal »

I have got a configuration panel, which is shown as a modal window.
While initialising the panel, saved co-ordinates are being loaded and applied via "moveModule("moduleName", posX, posY)";
When closing the panel, I need to retrieve the current window position, but calling "panelPosition("moduleName", "panelName", posX, posY)" only returns the panel position without taking the window frame into account.

How can I retrieve the absolute window position including the window title bar height and windows frame width?

Please let me know if you need more detail or code samples...

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Retrieve window size for modal panel

Post by leoknipp »

Hello,

when using the following config-entry you get the current window position and size when a module gets the focus. If the module already has the focus and is moved then the dp-elements are not updated.
[ui]
sendModuleFocusDp = 1

I couldn't find another solution to get the current window position.
Maybe you can get the position and size with some commands for the operating system which are then called with the system()-function.

Best Regards
Leopold Knipp
Senior Support Specialist

weirdal
Posts:34
Joined: Thu Mar 12, 2015 11:37 am

Re: Retrieve window size for modal panel

Post by weirdal »

I could not find anything helpful either...
So how do you guys do it? I guess I am not the first one to try and store modal window (panel) positions in a user profile for latter re-use.

Window position and size are to be applied when the panel is loaded and saved respectively on a panel's close event.

Help / ideas much appreciated...

weirdal
Posts:34
Joined: Thu Mar 12, 2015 11:37 am

Re: Retrieve window size for modal panel

Post by weirdal »

Never mind, I could work around it by computing the offset right when applying the saved coordinates in the load-Function.
When saving the values again, I subtract the offset upfront to get correct position values to store.

// move to stored display position
moveModule(mdlName, posX, posY);

// calc current window frame offset
int pnlX = 0, pnlY = 0;
panelPosition(mdlName, "", pnlX, pnlY);
_pnlOffsetX = pnlX - posX;
_pnlOffsetY = pnlY - posY;


Everything would be easier tho when you could retrieve the current module / window position as it is possible eg. for panelSize(string, int, int, bool), where you can specify if you want to get the original or the current value.

4 posts • Page 1 of 1