Posted: Thu Mar 08, 2007 3:42 pm
You are right
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
OpenWindow(0,0,0,400, 300,"",#PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
Repeat
Event = WaitWindowEvent()
If GetWindowState(0) = #PB_Window_Minimize And isMinimized = #False
If isMinimized = #False
isMinimized = #True
Debug "WINDOWS HAS BEEN MINIMIZED!"
EndIf
ElseIf GetWindowState(0) = #PB_Window_Normal And isMinimized = #True
isMinimized = #False
Debug "WINDOWS HAS BEEN RESTORED!"
EndIf
Until Event = #PB_Event_CloseWindow
Code: Select all
OpenWindow(0, 0, 0, 500, 400, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget )
OldState = GetWindowState(0)
Repeat
Event = WaitWindowEvent()
;{ State-Change "event"
State = GetWindowState(0)
If State <> OldState
OldState = State
Select State
Case #PB_Window_Minimize
Debug "just minimized"
Case #PB_Window_Maximize
Debug "just maximized"
Case #PB_Window_Normal
Debug "original size"
EndSelect
EndIf
;}
Until Event = #PB_Event_CloseWindow
Well, that was point, wasn't it?it's quite similar to my solution, just without an event-case before:
My code is 4 lines shorter you pedant!additionally, with this solution it's only one call of GetWindowState,
and only one IF when the event is no state-change.