#PB_Event_MinimizeWindow

Windows specific forum
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

#PB_Event_MinimizeWindow

Post by User_Russian »

I click the "Minimize all windows" button on the taskbar, but there are no event #PB_Event_MinimizeWindow.

Code: Select all

If OpenWindow(0, 0, 0, 200, 100, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
  Repeat
    Event = WaitWindowEvent()
    
    If Event = #PB_Event_MinimizeWindow
      Debug "MinimizeWindow"
    EndIf    
  Until Event = #PB_Event_CloseWindow
EndIf
BarryG
Addict
Addict
Posts: 3322
Joined: Thu Apr 18, 2019 8:17 am

Re: #PB_Event_MinimizeWindow

Post by BarryG »

User_Russian wrote:OpenWindow(0, 0, 0, 200, 100, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
Looks like you need the #PB_Window_MinimizeGadget flag for PureBasic to trigger a #PB_Event_MinimizeWindow event, and then it works. Don't know if this is by design, or a bug.
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: #PB_Event_MinimizeWindow

Post by User_Russian »

When a button is pressed on the taskbar all windows are minimized, so there must be an event #PB_Event_MinimizeWindow.
Cannot use #PB_Window_MinimizeGadget because this parameter conflicts with #PB_Window_BorderLess.
User avatar
mk-soft
Always Here
Always Here
Posts: 5400
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: #PB_Event_MinimizeWindow

Post by mk-soft »

I think its a bug with taskbar 'Show Desktop'

PB v5.72b2 : OS Window 7 Pro

The event order is not right...

Code: Select all


Procedure MyWindowCallback(WindowID, Message, wParam, lParam)
  Protected Result = #PB_ProcessPureBasicEvents
  Protected r1.s
  Select Message
    Case #WM_SIZE
      r1 = FormatDate("%HH.%II.%SS | ", Date()) + "WM_SIZE = "
      Select wParam
        Case #SIZE_RESTORED : r1 + "#SIZE_RESTORED"
        Case #SIZE_MINIMIZED : r1 + "#SIZE_MINIMIZED"
      EndSelect    
      Debug r1 
  EndSelect
  
  ProcedureReturn Result
EndProcedure

If OpenWindow(0, 0, 0, 200, 100, "", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
  SetWindowCallback(@MyWindowCallback())
  
  Repeat
    Event = WaitWindowEvent()
    
    Select event
      Case #PB_Event_MinimizeWindow
        Debug FormatDate("%HH.%II.%SS | ", Date()) + "MinimizeWindow"
        
    EndSelect
  Until Event = #PB_Event_CloseWindow
EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 5400
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: #PB_Event_MinimizeWindow

Post by mk-soft »

P.S. With BindEvent works...

Code: Select all


Procedure MyWindowCallback(WindowID, Message, wParam, lParam)
  Protected Result = #PB_ProcessPureBasicEvents
  Protected r1.s
  Select Message
    Case #WM_SIZE
      r1 = FormatDate("%HH.%II.%SS | ", Date()) + "WM_SIZE = "
      Select wParam
        Case #SIZE_RESTORED : r1 + "#SIZE_RESTORED"
        Case #SIZE_MINIMIZED : r1 + "#SIZE_MINIMIZED"
      EndSelect    
      Debug r1 
  EndSelect
  
  ProcedureReturn Result
EndProcedure


Procedure DoEvent_SizeWindow()
  Select Event()
    Case #PB_Event_MinimizeWindow
      Debug FormatDate("%HH.%II.%SS | ", Date()) + "MinimizeWindow"
    Case #PB_Event_MaximizeWindow
      Debug FormatDate("%HH.%II.%SS | ", Date()) + "MaximizeWindow"
    Case #PB_Event_RestoreWindow
      Debug FormatDate("%HH.%II.%SS | ", Date()) + "RestoreWindow"
  EndSelect
EndProcedure


If OpenWindow(0, 0, 0, 200, 100, "", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
  SetWindowCallback(@MyWindowCallback())
  
  BindEvent(#PB_Event_MinimizeWindow, @DoEvent_SizeWindow())
  BindEvent(#PB_Event_MaximizeWindow, @DoEvent_SizeWindow())
  BindEvent(#PB_Event_RestoreWindow, @DoEvent_SizeWindow())
  
  Repeat
    Event = WaitWindowEvent()
    
    Select event
;       Case #PB_Event_MinimizeWindow
;         Debug FormatDate("%HH.%II.%SS | ", Date()) + "MinimizeWindow"
;       Case #PB_Event_MaximizeWindow
;         Debug FormatDate("%HH.%II.%SS | ", Date()) + "MaximizeWindow"
;       Case #PB_Event_RestoreWindow
;         Debug FormatDate("%HH.%II.%SS | ", Date()) + "RestoreWindow"
        
    EndSelect
  Until Event = #PB_Event_CloseWindow
EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 5400
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: #PB_Event_MinimizeWindow

Post by mk-soft »

User_Russian wrote:When a button is pressed on the taskbar all windows are minimized, so there must be an event #PB_Event_MinimizeWindow.
Cannot use #PB_Window_MinimizeGadget because this parameter conflicts with #PB_Window_BorderLess.
No any events from window system ?!

Code: Select all

Procedure MyWindowCallback(WindowID, Message, wParam, lParam)
  Protected Result = #PB_ProcessPureBasicEvents
  Protected r1.s
  Select Message
    Case #WM_SIZE
      r1 = FormatDate("%HH.%II.%SS | ", Date()) + "WM_SIZE = "
      Select wParam
        Case #SIZE_RESTORED : r1 + "#SIZE_RESTORED"
        Case #SIZE_MINIMIZED : r1 + "#SIZE_MINIMIZED"
      EndSelect    
      Debug r1 
  EndSelect
  
  ProcedureReturn Result
EndProcedure

If OpenWindow(0, 50, 50, 200, 100, "", #PB_Window_SystemMenu | #PB_Window_BorderLess)
  SetWindowCallback(@MyWindowCallback())
  
  Repeat
    Event = WaitWindowEvent()
    Select event
    EndSelect
  Until Event = #PB_Event_CloseWindow
EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: #PB_Event_MinimizeWindow

Post by User_Russian »

mk-soft wrote:No any events from window system ?!
No events.
Strange, the window does not change position and size and it is displayed, but it is not on the screen.

Code: Select all

Procedure MyWindowCallback(WindowID, Message, wParam, lParam)
  Protected Result = #PB_ProcessPureBasicEvents
  Protected r1.s
  Select Message
    Case #WM_SIZE
      r1 = FormatDate("%HH.%II.%SS | ", Date()) + "WM_SIZE = "
      Select wParam
        Case #SIZE_RESTORED : r1 + "#SIZE_RESTORED"
        Case #SIZE_MINIMIZED : r1 + "#SIZE_MINIMIZED"
      EndSelect    
      Debug r1 
  EndSelect
  
  ProcedureReturn Result
EndProcedure

If OpenWindow(0, 50, 50, 200, 100, "", #PB_Window_BorderLess)
  SetWindowCallback(@MyWindowCallback())
  AddWindowTimer(0, 0, 1000)
  Repeat
    Event = WaitWindowEvent()
    Select event
      Case #PB_Event_Timer
        Debug "x="+WindowX(0)+" y="+WindowY(0)+" Width="+WindowWidth(0)+" Height"+WindowHeight(0)+" Visible="+
              IsWindowVisible_(WindowID(0))
    EndSelect
  Until Event = #PB_Event_CloseWindow
EndIf
Window with TOPMOST style does not minimize.

Code: Select all

If OpenWindow(0, 50, 50, 200, 100, "", #PB_Window_BorderLess)
  StickyWindow(0, #True)
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf
This is probably not a PB bug.
Post Reply