Page 1 of 1

#PB_Event_MinimizeWindow

Posted: Sat Mar 07, 2020 12:17 pm
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

Re: #PB_Event_MinimizeWindow

Posted: Sat Mar 07, 2020 1:33 pm
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.

Re: #PB_Event_MinimizeWindow

Posted: Sat Mar 07, 2020 1:42 pm
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.

Re: #PB_Event_MinimizeWindow

Posted: Sat Mar 07, 2020 1:53 pm
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

Re: #PB_Event_MinimizeWindow

Posted: Sat Mar 07, 2020 2:16 pm
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

Re: #PB_Event_MinimizeWindow

Posted: Sat Mar 07, 2020 2:26 pm
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

Re: #PB_Event_MinimizeWindow

Posted: Sat Mar 07, 2020 8:48 pm
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.