Syntax
Success = WindowSetTitle(Window, Title$)
Description
Sets the text displayed in the title bar of the specified ProGUI window.
Parameters
Window
The handle of the ProGUI window whose title is to be set.
Title$
The new title string for the window.
Return Value
Returns #True if the title was successfully set (or queued to be set), or #False if the window handle was invalid.
Remarks
This function updates the window title that is typically displayed by the operating system's window manager. The update might be asynchronous, potentially handled by the render thread via a posted message (`#WM_SETTITLE` on Windows).
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
; Event handler to trigger the title change after animation ends
Procedure DelayedTitleHandler(Window, EventType, *EventData.PG_EventAnimate, *UserData)
If EventType = #PG_Event_Animate And *EventData\state = #PG_Event_Animate_End
Debug "Animation finished, updating window title..."
WindowSetTitle(Window, "Updated Window Title!")
Debug "Window title updated (check title bar)."
EndIf
EndProcedure
MyWindow = CreateWindow(0, 0, 300, 200, "Initial Title")
If MyWindow
AddEventHandler(MyWindow, #PG_Event_Animate, @DelayedTitleHandler()) ; Add handler for animation end
WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)
Debug "Window shown, waiting 2 seconds via animation before changing title..."
; Start a 2-second animation. When it ends, the handler will change the title.
StartAnimation(MyWindow, 1, 2000) ; ID 1, Duration 2000ms
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()
See Also
CreateWindow, WindowGetTitle, StartAnimation, AddEventHandler
Supported OS
Windows, Linux