MaxGUI Window Centering & Multiple Monitors
BlitzMax Forums/BlitzMax Programming/MaxGUI Window Centering & Multiple Monitors
| ||
Is there any way to specify a monitor to center a window gadget on? Currently the created window is centered between both monitors, so it crosses over and it doesn't look good (at all).Global frmMakePak:TGadget = CreateWindow( "MakePak", (GadgetWidth(Desktop())-512)/2, (GadgetHeight(Desktop())-200)/2, 512, 256, Null, WINDOW_TITLEBAR ) Basically, that's what I have thus far. If anyone has any ideas I'd greatly appreciate if you posted them. |
| ||
the problem is win32maxgui.mod/win32gui/win32desktop.cpp which uses the GetSystemMetrics call to initialize the deskop gadgets size but I think should be using the following constants: SM_CXSCREEN, SM_CYSCREEN I suggest you do your own call to GetSystemMetrics and let me know if you can get the correct results using the above. I'm guessing if your primary monitor has a non 0,0 origin (is this possible?) it won't be quite that straight forward. |
| ||
I'm not sure if it's possible, I'd doubt it though, since Windows probably repositions all monitors relative to the primary monitor (which would always be at 0,0 presumably). Anyhow, changing it to SM_C{XY}SCREEN did the trick. Thanks, skid. |
| ||
Noel - If you use ClientWidth(Desktop()) and ClientHeight(Desktop()) you will get the primary monitor dinensions. At least it works for me on my dual monitor setup. |
| ||
Thanks, TeaVirus :) |