WindowCentered and ScreenCentered

Just starting out? Need help? Post your questions and find answers here.
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

WindowCentered and ScreenCentered

Post by es_91 »

Code: Select all


HideWindow  (  window,  #false,  #pb_window_screenCentered  )

Works. Places the window in the center of the screen.

Code: Select all


HideWindow  (  window,  #false,  #pb_window_screenCentered  |  #pb_window_windowCentered  )

Works not.
:mrgreen:
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: WindowCentered and ScreenCentered

Post by Fred »

Both flags can't be used together, what should it do ?
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: WindowCentered and ScreenCentered

Post by BarryG »

I didn't know unhiding a window even had these flags. :shock: They're not mentioned in the History.
User avatar
Piero
Addict
Addict
Posts: 1040
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: WindowCentered and ScreenCentered

Post by Piero »

Dear Forum, please; there are already enough false flags in history :?
Quin
Addict
Addict
Posts: 1135
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: WindowCentered and ScreenCentered

Post by Quin »

BarryG wrote: Fri Aug 23, 2024 11:42 am I didn't know unhiding a window even had these flags. :shock: They're not mentioned in the History.
Me neither, I've looked at this function's documentation numerous times and somehow that piece of info never stuck with me. Here are all the flags, from the docs:
#PB_Window_NoActivate : the window will be shown but not activated (only valid when un-hiding the window).
#PB_Window_ScreenCentered: the window will be screen centered (only valid when un-hiding the window).
#PB_Window_WindowCentered: the window will be window centered (only valid when un-hiding the window).
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Re: WindowCentered and ScreenCentered

Post by es_91 »

Fred wrote: Fri Aug 23, 2024 11:35 am Both flags can't be used together, what should it do ?
ParentId is by default zero, equals #HWND_DESKTOP.

Shouldn't a desktop-centered window or a screen-centered window be similar? But here comes none of both. They disable one another.
:mrgreen:
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: WindowCentered and ScreenCentered

Post by DarkDragon »

es_91 wrote: Fri Aug 23, 2024 8:20 pm
Fred wrote: Fri Aug 23, 2024 11:35 am Both flags can't be used together, what should it do ?
ParentId is by default zero, equals #HWND_DESKTOP.

Shouldn't a desktop-centered window or a screen-centered window be similar? But here comes none of both. They disable one another.
But screen centered | window centered makes no sense at all, I mean you EITHER want it centered in the screen or in the parent window, not both at once because that would be contradicting.
bye,
Daniel
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Re: WindowCentered and ScreenCentered

Post by es_91 »

No no, the empty ParentId should MEAN the desktop as the parent, thus equals the screenCentered flag.


Both flags should not turn off each other because there IS ONE case in which they mean the same.


If WindowCentered is superior to ScreenCentered, then i can understand it turns that later off, but if no ParentId is given, technically the desktop is the parent, so it should center on the screen nevertheless.


(( If there is no difference whether the sysTray shall take influence on the center position or not. ))
:mrgreen:
Little John
Addict
Addict
Posts: 4803
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: WindowCentered and ScreenCentered

Post by Little John »

es_91 wrote: Fri Aug 23, 2024 9:25 pm Both flags should not turn off each other because there IS ONE case in which they mean the same.
And in that case in which they mean the same, why do you want to use both flags together :?:
As in all other cases, just use one or the other.
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: WindowCentered and ScreenCentered

Post by DarkDragon »

es_91 wrote: Fri Aug 23, 2024 9:25 pm No no, the empty ParentId should MEAN the desktop as the parent, thus equals the screenCentered flag.


Both flags should not turn off each other because there IS ONE case in which they mean the same.


If WindowCentered is superior to ScreenCentered, then i can understand it turns that later off, but if no ParentId is given, technically the desktop is the parent, so it should center on the screen nevertheless.


(( If there is no difference whether the sysTray shall take influence on the center position or not. ))

Code: Select all

If GetParent_(WindowID(#Wnd)) <> 0
  HideWindow(#Wnd, ..., WindowCentered)
Else
  HideWindow(#Wnd, ..., ScreenCentered)
EndIf
However flags should never imply an order, so doing it implicitly in HideWindow would be dirty.
bye,
Daniel
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: WindowCentered and ScreenCentered

Post by BarryG »

es_91 wrote: Fri Aug 23, 2024 9:25 pmif no ParentId is given, technically the desktop is the parent
No, not at all. That's just you making up a rule to suit your preferences.
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Re: WindowCentered and ScreenCentered

Post by es_91 »

BarryG wrote: Sat Aug 24, 2024 8:30 am
es_91 wrote: Fri Aug 23, 2024 9:25 pmif no ParentId is given, technically the desktop is the parent
No, not at all. That's just you making up a rule to suit your preferences.
Try this:

Code: Select all

debug #HWND_DESKTOP
I just assumed that since it's zero, logically no parent means parent is the desktop.
:mrgreen:
Post Reply