Contents Up Previous Next

Overview of wxCLIPS GUI functionality

Using wxCLIPS, you can create frames, each with an optional menu bar comprising a number of menus. Within a frame, you can create one or more subwindows. Subwindows can be panels, canvases and text subwindows.

Panels are used to contain panel items, such as buttons, text-entry items and list boxes. You can place panel items at specific places, or omit the position information in which case a left-to-right, top-to-bottom layout policy is used.

The dialog box is a special form of panel which has its own frame, so instead of creating a frame and a panel, you just create a dialog box and populate it with panel items.

Canvases are used for drawing arbitrary graphics. To issue drawing commands, the handle of the canvas device context must be used, because device contexts can represent other devices also, such as printers and metafiles. The concepts of pen and brush allow separate setting of outline and fill attributes, and fonts may be created and assigned to the device context before drawing text. User input on a canvas is handled by registering OnEvent and OnChar handler functions, and using event accessor functions to find out about the input event.

Text subwindows are used for displaying text files or writing text programmatically, and in the case of the X version of wxCLIPS, editing the text directly.

Because your program may have to respond to feedback from the user, such as resizing or closing of frames, it is often necessary to install event handlers using window-add-callback to tell wxCLIPS what function to call when a user event happens. You may wish to handle frame resize events by calculating positions and sizes for subwindows and setting their sizes. If there is only one subwindow, wxCLIPS handles subwindow resizing automatically if no event handler is supplied.

Instead of using explicit resizing, you can use the window-fit function to fit a frame or panel around its contents. For example, you can create a frame, a panel, some items on the panel, and then fit the panel to the items, and finally fit the frame to the panel.

You don't always have to create a dialog box manually, and handle all the button presses and other events; there is a small number of convenience functions, such as get-text-from-user, message-box, get-choice and file-selector. These all block the program flow at the point at which they were called, until the user dismisses the dialog in some way. Your program can examine the value returned and carry on.

Restrictions


Restrictions

The CLIPS function interface to the portable GUI library wxWindows is extensive but not yet complete.

To some extent the development of wxCLIPS is driven by user demand, and what we have time to do. Suggestions or requests for extensions are welcome.

The major difference with standard CLIPS is that the (read) function does not take input from standard input, and in fact there is no concept of standard input in wxCLIPS. Such functions must be replaced with GUI calls such as get-text-from-user.