Syntax
Success = WindowShow(Window, isVisible=#True, Flags=#Null)Description
Shows or hides the specified ProGUI window. Windows are created initially hidden and must be shown using this command to become visible to the user.
Parameters
Window
The handle of the ProGUI window to show or hide.
isVisible (optional)
Set to #True to show the window or #False to
hide it. Default is #True.
Flags (optional)
Additional flags that modify how the window is shown (only applicable
when isVisible is #True). Default is 0.
#PG_WindowShow_NoActivate : Shows the window without activating it or giving it input focus.
#PG_WindowShow_ScreenCentered : Centers the window on the screen when shown.
#PG_WindowShow_WindowCentered : Centers the window relative to its parent window (if it has one) when shown.
#PG_WindowShow_Minimize : Minimizes the window to the taskbar.
#PG_WindowShow_Maximize : Maximizes the window.
#PG_WindowShow_Restore : Restores the window from a minimized or maximized state.
#PG_WindowShow_NoUpdate : Shows the window immediately using OS functions rather than queuing through the ProGUI update cycle.
Return Value
Returns #True if the operation was successful, or
#False if the window handle was invalid.
Remarks
When showing a window, it's common to use flags like
#PG_WindowShow_ScreenCentered or
#PG_WindowShow_WindowCentered for initial placement. The
standard way to show a window involves ProGUI's update cycle (by default
or by omitting #PG_WindowShow_NoUpdate), which ensures
proper state management. Hiding a window simply makes it invisible; its
state and contents are preserved.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
; Animation IDs
#ANIM_ID_HIDE = 1
#ANIM_ID_SHOW_AGAIN = 2
; Event handler to manage showing/hiding
Procedure DelayedShowHideHandler(Window, EventType, *EventData.PG_EventAnimate, *UserData)
If EventType = #PG_Event_Animate And *EventData\state = #PG_Event_Animate_End
Select *EventData\id
Case #ANIM_ID_HIDE
Debug "Animation 1 finished, hiding window..."
WindowShow(Window, #False)
Debug "Window Hidden"
; Start the next animation to show it again after 2 seconds
StartAnimation(Window, #ANIM_ID_SHOW_AGAIN, 2000)
Debug "Waiting 2 seconds via animation before showing again..."
Case #ANIM_ID_SHOW_AGAIN
Debug "Animation 2 finished, showing window (no activate)..."
WindowShow(Window, #True, #PG_WindowShow_NoActivate)
Debug "Window Shown (No Activate)"
EndSelect
EndIf
EndProcedure
MyWindow = CreateWindow(0, 0, 400, 300, "Show/Hide Example")
If MyWindow
AddEventHandler(MyWindow, #PG_Event_Animate, @DelayedShowHideHandler())
; Show the window centered initially
WindowShow(MyWindow, #True, #PG_WindowShow_ScreenCentered)
Debug "Window Shown"
; Start the first animation timer (2 seconds) to hide the window
StartAnimation(MyWindow, #ANIM_ID_HIDE, 2000)
Debug "Waiting 2 seconds via animation before hiding..."
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()See Also
CreateWindow, StartAnimation, AddEventHandler
Supported OS
Windows, Linux