What is PB constant for Window Minimize?[SOLVED]
-
- Enthusiast
- Posts: 339
- Joined: Tue Jan 30, 2007 5:47 am
- Location: Hong Kong
- Fluid Byte
- Addict
- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
My question still remains SkyManager.
Do you ned this to be crossplatform compatible or is that not an issue?
Do you ned this to be crossplatform compatible or is that not an issue?
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
-
- Enthusiast
- Posts: 339
- Joined: Tue Jan 30, 2007 5:47 am
- Location: Hong Kong
- Fluid Byte
- Addict
- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
So #PB_Event_DeactivateWindow only works for Linux and #PB_Event_MoveWindow only for Windows. Hmmm...
* scratches head *
Actually you could just use GetWindowState() alone but it would fire the event multiple times. But adding a boolean check should fix this:
This should work on Linux as well, shouldn't it?
* scratches head *
Actually you could just use GetWindowState() alone but it would fire the event multiple times. But adding a boolean check should fix this:
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
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
it's quite similar to my solution, just without an event-case before:
additionally, with this solution it's only one call of GetWindowState,
and only one IF when the event is no state-change.
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
and only one IF when the event is no state-change.
oh... and have a nice day.
- Fluid Byte
- Addict
- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
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.

Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
The best is to use CompilerIf, GetWindowState on all events is bad
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
