Changing the Title Bar

The title bar is the area at the top of each frame window
that contains a window title.

You can specify the icon which displays when the application is minimized. Using the minimizedIcon style when you create the frame window.

For Windows and OS/2, if you do not provide a window title, the Open Class Library sets the title to a string loaded from the application's resource library. The ID of the string in the string table is the frame window's ID.

In Motif, if you do not provide a window title, Open Class Library looks for a string in the application's resource file. If the Open Class Library cannot find a string, the title defaults to the system-generated title (typically, the name of the executable file).

The following code, from Hello World version 3, shows you how to specify a minimized icon and the window title when you create the frame window.

  1. The title text is defined in the resource file:
    ICON WND_MAIN ahellow3.ico                      //Application icon             
     
    STRINGTABLE
      BEGIN
        STR_HELLO,  "Hello, World!!!"               //Hello World string           
        WND_MAIN,   "Hello World Sample - Version 3"   //Main window title string     
    
    

    WND_MAIN is the frame window identifier. The frame window uses the window identifier (windowId) passed on the constructor to load its icon, title, menu bar, or accelerator table resources if these components are specified in the frame window style.

  2. The following code comes from the ahellow3.cpp file:
    int main()                                                                    
    {                                                                              
      ICoordinateSystem::setApplicationOrientation(
              ICoordinateSystem::koriginLowerLeft );
      AHelloWindow mainWindow (WND_MAIN);                                          
      mainWindow.setTextAlignment(AHelloWindow::left);                                 
      mainWindow.sizeTo(ISize(400,300));                                           
      mainWindow.setFocus();                                                       
      mainWindow.show();                                                           
      IApplication::current().run();                                          
      return 0;
    } /* end main */                                                               
    
    AHelloWindow :: AHelloWindow(unsigned long windowId)                      
      : IFrameWindow(IFrameWindow::defaultStyle() |                           
                     IFrameWindow::minimizedIcon,                  
                     windowId)                                                     
    
    

    When the application creates the AHelloWindow object, it constructs the IFrameWindow base class using the default style with a minimized icon, ahello3.ico, and "Hello World Sample - Version 3" as the title text. The frame window determines the icon and title text based on the window ID and
    the resource library.

To access or change your framewindow's title, use the IFrameWindow::title and IFrameWindow::setTitle member functions. You could also create an ITitle object.

The ITitle class creates and updates the title bar area of your frame window. The ITitle class consists of the following three components:

When you construct a title, you must provide the object text, while the other two are optional. The Open Class Library separates the object text and view text with a hyphen (-). The library separates the view text and view number with a colon (:). For example:

     OS/2 System - Icon View:2

Use ITitle if you want the Common User Access (CUA) support for the object, view, and view number. If you do not, you can specify a title using an IFrameWindow constructor.

The title may exceed 60 bytes in length, but only the first 60 bytes appear in a Window List entry. Use IFrameWindow::addToWindowList to add entries to the window list.

An ITitle window is not a separate window on the Windows operating system. The mechanism of autoDeleteObject (which deletes the object when the window is deleted) does not occur because there is no window being deleted. Therefore, do not use autoDeleteObject but instead perform your own delete for the objects that your application creates using new.



Windows


Creating a Frame Window
Creating an Information Area


IFrameWindow
ITitle