Page 1 of 1

#PB_Window_ScreenCentered | #PB_Window_Minimize

Posted: Tue Sep 24, 2013 7:09 pm
by eJan
Hello, long time i haven't found anything misunderstood, until now. In PB 4.xx i have used:

Code: Select all

#PB_Window_ScreenCentered | #PB_Window_Minimize
where the window is opened minimized, when restored it is positioned in the center of the screen, but in PB 5.20 the window is minimized, but when restored its position is top left of the screen, so the flag #PB_Window_ScreenCentered is ignored. For the solution i have to set minimized state after positioning the window centered?

Code: Select all

If OpenWindow(0, 0, 0, 222, 200, "ButtonGadgets", #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered | #PB_Window_Minimize)
    ;SetWindowState(0, #PB_Window_Minimize)
    ButtonGadget(0, 10, 10, 200, 20, "Standard Button")
    ButtonGadget(1, 10, 40, 200, 20, "Left Button", #PB_Button_Left)
    ButtonGadget(2, 10, 70, 200, 20, "Right Button", #PB_Button_Right)
    ButtonGadget(3, 10,100, 200, 60, "Multiline Button  (longer text gets automatically wrapped)", #PB_Button_MultiLine)
    ButtonGadget(4, 10,170, 200, 20, "Toggle Button", #PB_Button_Toggle)
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Re: #PB_Window_ScreenCentered | #PB_Window_Minimize

Posted: Tue Sep 24, 2013 9:48 pm
by davido
Hi eJan,

Interesting ....
Confirmed with PB520LTS 64 bit, Windows 764.

Looks like it might be a bug.

Re: #PB_Window_ScreenCentered | #PB_Window_Minimize

Posted: Wed Sep 25, 2013 3:39 pm
by chi
HideWindow(#Win, #False, #PB_Window_ScreenCentered) :wink:

Re: #PB_Window_ScreenCentered | #PB_Window_Minimize

Posted: Wed Sep 25, 2013 5:27 pm
by IdeasVacuum
It's normal behaviour? #PB_Window_ScreenCentered when the Window is first launched and displayed. The User may well move the Window, and it should return to it's prior (User) location when returned from a User-applied minimised state. So, for a pre-minimised window, chi's answer is correct.

There is another consideration though - why open a window minimised? It could annoy or confuse the User. You can update a hidden window...... :|

Re: #PB_Window_ScreenCentered | #PB_Window_Minimize

Posted: Wed Sep 25, 2013 5:43 pm
by BorisTheOld
IdeasVacuum wrote:why open a window minimised? It could annoy or confuse the User.
Not if someone wants to pre-load a number of related programs, but not have them all cluttering the screen.

The main application would be displayed, but the minimized ones are quickly available if needed.

This is a lot less annoying than displaying them all and having to minimize the ones that are not immediately needed.

Re: #PB_Window_ScreenCentered | #PB_Window_Minimize

Posted: Wed Sep 25, 2013 5:59 pm
by chi
Works like expected ^^

Code: Select all

If OpenWindow(0, 0, 0, 222, 200, "ButtonGadgets", #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered | #PB_Window_Invisible)
  
  ButtonGadget(0, 10, 10, 200, 20, "Standard Button")
  ButtonGadget(1, 10, 40, 200, 20, "Left Button", #PB_Button_Left)
  ButtonGadget(2, 10, 70, 200, 20, "Right Button", #PB_Button_Right)
  ButtonGadget(3, 10,100, 200, 60, "Multiline Button  (longer text gets automatically wrapped)", #PB_Button_MultiLine)
  ButtonGadget(4, 10,170, 200, 20, "Toggle Button", #PB_Button_Toggle)
  
  SetWindowState(0, #PB_Window_Minimize)
  HideWindow(0, #False)
  
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

Re: #PB_Window_ScreenCentered | #PB_Window_Minimize

Posted: Wed Sep 25, 2013 7:37 pm
by IdeasVacuum
@BorisTheOld - you can do that without cluttering the taskbar, given that we are talking about windows belonging to the main app - just have a toolbar or menu in the app's main window to show/hide them.