#PB_Window_ScreenCentered | #PB_Window_Minimize

Just starting out? Need help? Post your questions and find answers here.
eJan
Enthusiast
Enthusiast
Posts: 366
Joined: Sun May 21, 2006 11:22 pm
Location: Sankt Veit am Flaum

#PB_Window_ScreenCentered | #PB_Window_Minimize

Post 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
Image
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: #PB_Window_ScreenCentered | #PB_Window_Minimize

Post by davido »

Hi eJan,

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

Looks like it might be a bug.
DE AA EB
User avatar
chi
Addict
Addict
Posts: 1087
Joined: Sat May 05, 2007 5:31 pm
Location: Austria

Re: #PB_Window_ScreenCentered | #PB_Window_Minimize

Post by chi »

HideWindow(#Win, #False, #PB_Window_ScreenCentered) :wink:
Et cetera is my worst enemy
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: #PB_Window_ScreenCentered | #PB_Window_Minimize

Post 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...... :|
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: #PB_Window_ScreenCentered | #PB_Window_Minimize

Post 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.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
User avatar
chi
Addict
Addict
Posts: 1087
Joined: Sat May 05, 2007 5:31 pm
Location: Austria

Re: #PB_Window_ScreenCentered | #PB_Window_Minimize

Post 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
Et cetera is my worst enemy
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: #PB_Window_ScreenCentered | #PB_Window_Minimize

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply