Page 1 of 1
WindowCentered and ScreenCentered
Posted: Fri Aug 23, 2024 10:18 am
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.
Re: WindowCentered and ScreenCentered
Posted: Fri Aug 23, 2024 11:35 am
by Fred
Both flags can't be used together, what should it do ?
Re: WindowCentered and ScreenCentered
Posted: Fri Aug 23, 2024 11:42 am
by BarryG
I didn't know unhiding a window even had these flags.

They're not mentioned in the History.
Re: WindowCentered and ScreenCentered
Posted: Fri Aug 23, 2024 4:33 pm
by Piero
Dear Forum, please; there are already enough false flags in history

Re: WindowCentered and ScreenCentered
Posted: Fri Aug 23, 2024 6:01 pm
by Quin
BarryG wrote: Fri Aug 23, 2024 11:42 am
I didn't know unhiding a window even had these flags.

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).
Re: WindowCentered and ScreenCentered
Posted: Fri Aug 23, 2024 8:20 pm
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.
Re: WindowCentered and ScreenCentered
Posted: Fri Aug 23, 2024 8:48 pm
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.
Re: WindowCentered and ScreenCentered
Posted: Fri Aug 23, 2024 9:25 pm
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. ))
Re: WindowCentered and ScreenCentered
Posted: Fri Aug 23, 2024 10:37 pm
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.
Re: WindowCentered and ScreenCentered
Posted: Sat Aug 24, 2024 7:19 am
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.
Re: WindowCentered and ScreenCentered
Posted: Sat Aug 24, 2024 8:30 am
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.
Re: WindowCentered and ScreenCentered
Posted: Sat Aug 24, 2024 10:24 pm
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:
I just assumed that since it's zero, logically no parent means parent is the desktop.