Page 1 of 1

An option to center a window in the client area

Posted: Sun Apr 13, 2008 12:51 pm
by Derek
Centered screens don't take into account the taskbar, would be handy to have a #pb_window_clientCentered flag or similar.

I know this code isn't getting the actual size of the client area, but if it did then it would still center it in the middle of the screen and not offset it due to the position of the taskbar.

Code: Select all

ExamineDesktops()
w=DesktopWidth(0)
h=DesktopHeight(0)-64; simulate taskbar height 
OpenWindow(0, 0, 0, w, h, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget) 
Repeat 
  Select WaitWindowEvent() 
    Case #PB_Event_CloseWindow 
      Break 
  EndSelect 
ForEver

Posted: Sun Apr 13, 2008 1:46 pm
by Hroudtwolf
Some of people doesn't use the windows shell.
How do you envisage that with alternative shells?

Best regards
Wolf

Posted: Sun Apr 13, 2008 1:49 pm
by Derek
Regardless of the shell being used there must still be a client area (be it full screen or whatever) so even if it is full screen then the window will be centered correctly.

Anyway, if it is a flag then it doesn't have to be used, it would just be an option.