KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Dynamically Setting the Title of the Current Form Window
PRODUCT: 4D | VERSION: 2003.4 | PLATFORM: Mac & Win
Published On: August 19, 2004

In many cases, you may find yourself using one window to display several forms. To appropriately describe each form, a short description is often set to the window's title. This type of behavior requires that the window title is set dynamically. To do this, you need to use the command SET WINDOW TITLE.

Here is one example of how to deal with the above situation. For each form that you want to have this behavior applied to, place the following codes into the form method and activate the On Load and On Unload events to the Form Properties.

Case of
  : (Form event=On Load )
    C_TEXT(vtWinTitle)
    vtWinTitle:=Get window title ` Get the current title of the window.
    SET WINDOW TITLE("New Window Title") `Set the current window to a new title.
  : (Form event=On Unload)
    SET WINDOW TITLE(vtWinTitle) ` Set the current window to the previous title.
End case

Please note that the command SET WINDOW TITLE is not restricted to only for the On Load and On Unload events. It depends how you want your application to behave.