Enhanced Capabilities of QuickWin

Many C and C++ programs require no changes in order to be compiled as QuickWin applications. You also have the option of giving your program more of a Windows look and greater flexibility using features described in this section. Details about using the features and calling QuickWin library functions are covered in “Writing Enhanced QuickWin Programs”.

About Dialog Box

Summary: You can customize the About dialog box.

In Windows, an “About” dialog box identifies your program by name and supplies a copyright notice. This dialog box appears when the user chooses the About command in the QuickWin Help menu. By default, QuickWin displays information about QuickWin itself, but you can customize the dialog box by specifying a text string to display. Use the _wabout function to set the About text. Figure 8.3 shows the About dialog box as it appears in the example program QWDEMO.C, which is described later in the chapter.

Multiple Child Windows

By default, QuickWin displays a client window with a menu bar and one child window, titled “Stdin/Stdout/Stderr.” The default input/output streams use this window. However, you have the option of opening additional child windows. Use the _fwopen or _wopen functions to open new windows. (These functions are described in “Writing Enhanced QuickWin Programs”.) If your program reads or writes multiple files, you can use document windows to display those files on the screen.

Active Window

When you open multiple child windows, the foremost window automatically becomes the active window. In Windows, the active window also is said to have the “input focus,” which means that keyboard input is directed to this window. Use the _wgetfocus function to examine which window is active. Use the _wsetfocus function to make a particular window the active window. These routines are useful for bringing a hidden or partially obscured window to the foreground. The QWDEMO.C program supplied on the distribution disk demonstrates using these functions.

Program Control of Menus

Users of a Windows program can choose commands from the menu bar either with the mouse or with the keyboard. Your program can also choose some of these commands for its own purposes, without user intervention. While your program cannot add menus of its own to the menu bar, it can have some control over QuickWin's default menus by simulating a mouse click in a given menu item, as if a user had chosen the menu command with the mouse.

The menu commands you can activate in this way are limited to the Tile, Cascade, Arrange Icons, and Status Bar commands in the Window menu. Simulating menu clicks is especially useful if you want your program's document windows to appear initially in certain positions on the screen. For example, you might want them either tiled or cascaded. Use the _wmenuclick function to activate a menu command under program control. This feature is useful for setting up the initial configuration of windows and status bar in your program and for reconfiguring them as conditions change.

Program Control of Windows

In your program, you can also directly control the size and position of child windows and the amount of text they retain for scrolling, and you can control how your program behaves when an exit function executes.

Use the _wgetsize and _wsetsize functions to determine or to reset a window's current size and position. Use_wgetscreenbuf to get the size of a window's text buffer (the amount of text it can retain and scroll through). Use _wsetscreenbuf to set the size of a window's text buffer so it can retain more or less text. For example, you can read a text file and write it into a window with an appropriately sized buffer so that users can scroll through the entire contents of the file.

Use the _wsetexit and _wgetexit functions to specify whether or not your program's windows remain on the screen when the program executes an exit function. Your program can behave in three possible ways at exit time:

It leaves all windows on the screen by default.

It leaves no windows on the screen.

It allows user to choose windows or no windows using a dialog box.

Use _wgetexit to get the current exit behavior setting. Use _wsetexit to set the desired exit behavior. For more information about these functions, see “Keeping Windows on the Screen”.