Miniwindows Position

Posted by Rene on Thu 07 Jun 2018 11:44 PM — 4 posts, 16,633 views.

#0
I am having an issue that if I use the auto-positioning to start my miniwindow with WindowCreate on the bottom right (miniwin.pos_bottom_right) WindowInfo 1 and 2 as well as 11 and 12 both return 0 since that was the setting for long Left and long Top even though it is clearly not on the top left of my screen but the bottom right.
This causes an issue since later I use those settings when resizing, so it jumps to the top right, is there a way to create the window so it also gets those numbers correct?
Thanks.
Australia Forum Administrator #1
WindowInfo 10 and 11 (not 11 and 12) will return the left and top of when it was last drawn. However for that to work the window must be drawn. This is because the auto-positioning works out the location each time the window is drawn, in case you resize your main window. Example code:


win = "test_" .. GetPluginID () 
WindowCreate (win, 0, 0, 200, 200, miniwin.pos_bottom_right, 0, ColourNameToRGB("white"))  -- create window
WindowShow (win,  true)  -- show it 
Repaint ()  -- Force redraw of window
print ("Left =",  WindowInfo (win, 10), " Top =", WindowInfo (win, 11))



With the Repaint call there, I get:


Left = 1115  Top = 486


If you omit Repaint, I get 0 and 0.
Amended on Fri 08 Jun 2018 03:47 AM by Nick Gammon
#2
Will that also work for WinInfo 1 and 2?
Thanks.
Australia Forum Administrator #3
No, because as the documentation says, it returns what you supplied to WindowCreate.