Window class

winclass = “text

This clause is used to assign a class name to a window.

The activate_app() function activates a top-level window in another application and brings it to the foreground. However, the class name of the window must be known. Sculptor automatically assigns a class name to each window if none is specified, but there is no way to retrieve this name.

The winclass clause provides the means to allocate a known name to a window in a Sculptor program. This allows a program to check if the window is currently running, and if so, to activate it, by calling the activate_app() function. If the function returns an error status the window is not running, and must be started by means of the create command. The following example illustrates this:

-window winmain at 0,0 {
     winclass = "ProgClass"
     ...
}
     if (activate_app(winmain->winclass, NULL) = OKAY) {
          sys.RestoreFocus = OFF
          exit
     }

     create winmain

NOTES

  • A window icon is a property of the window class, not of the actual window, so the same class name should not be assigned to windows which have different icons.

  • If this property is changed at run time, the window must first be destroyed.


RELATED TOPICS

Windows