Format windows

In this section:

This section presents an overview of the ClearWin+ function winio@ that was introduced in ClearWin+ tutorial. Further details are given in the following sections up to Format code reference which provides a detailed reference.

winio@ is used to lay out and control a window in order to include a wide variety of controls, child windows, toolbars, etc.. Of course, this task could be carried out by making direct use of the Windows API. Although the direct method does provide maximum flexibility, it also requires large amounts of complex coding in order to control the interface. In contrast, the winio@ function requires a bare minimum of code to achieve elaborate window interfaces.

Windows applications typically have a great deal of "low level" functionality. For example, a window with several input controls will let the user move between fields using the tab key or the mouse. Likewise, buttons change their appearance slightly when they acquire focus. Fortunately you do not need to write code to program this functionality into your application, as it is already supplied by ClearWin+.

The following example illustrates the power and flexibility of winio@. In this example winio@ is used to produce a window that includes a menu bar with associated standard call-back functions. The window contains a so-called edit box that is used to display and edit a file. The menu and edit box is fully functional. Three buttons are also shown on the right hand side of the window. These are used to illustrate how buttons are added to the window. As the example stands, clicking on any of these buttons has no effect since code for the corresponding processes has been omitted.

      INCLUDE <windows.ins>
      CHARACTER*129 file,new_file,help_file
      INTEGER compile,link,run,i
      EXTERNAL compile,link,run
     +         file)
     +         new_file)
      i=winio@('%mn[[Save &As]]&','EDIT_FILE_SAVE_AS','*.*',
     +         new_file)
      i=winio@('%mn[[&Paste]]&', 'PASTE')
     +         help_file)
      i=winio@('%mn[[&Help on help]]&','HELP_ON_HELP',
     +         help_file)
c---  Define a 30x10 edit box %eb ---
c---  Define buttons that are to be dispalyed ---
      i=winio@('%2nl      %^7bt[&Compile]&',compile)
      i=winio@('%2nl      %^7bt[&Link]&',   link)
      i=winio@('%2nl      %^7bt[&Run]',     run)
c---  Call-back functions that do nothing ---
      INTEGER FUNCTION compile()

This is what the window looks like on the screen:

The reminder of this chapter and the following chapters up to and including Format code reference provide a detailed explanation of how to set out the parameters of winio@.



Copyright © 1999-2024 Silverfrost Limited