An option to center a window in the client area

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

An option to center a window in the client area

Post 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
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

Some of people doesn't use the windows shell.
How do you envisage that with alternative shells?

Best regards
Wolf
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post 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.
Post Reply