Purpose |
To allow interactive window design. |
|||||||||||||||||||||||||||
Syntax |
winio@('%wi', ID) |
|||||||||||||||||||||||||||
Description |
%wi enables the user to adjust and fix the exact position and size of every item in a window. %wi provides a window with a unique user ID (for example, the value 10). The designed windows are stored in a .rcx file. iw = winio@("%wi&", 10)
You enter a design mode by adding a tilde modifier (~), removing it to lock the design when finished: iw = winio@("%~wi&", 10)
When you run the application with the tilde applied, you will be able to select items with a mouse click and move them by dragging. If the Ctrl key is held down when clicking on an item then it remains selected and its size and position can be changed by using the arrow keys:
With the Ctrl key applied:
With the Shift key applied, the pixel change is increased from 1 to 10. New controls can be dropped on to the window by selecting from a (right click) menu. These can be resized and repositioned. Also their properties can be changed from a one of three property dialogs:
With the controls defined in a .rcx resource script, the only remaining requirement is to pass the associated variables so that the window can be linked up with the Fortran code. For example, a %rd (Edit Integer) format code has an associated integer variable (N say) where the result is stored. Now that %rd (Edit Integer) appears in the resource script and not in a winio@ call, we need an independent way to pass N. New format codes are provided for this purpose: iw = winio@("%qd[N]", N)
%qd is the new format code and [N] provides the name of the variable as it appears in the design process and in the resulting .rcx resource script. It is natural to use N as the name of the variable N provided that it is unique when designing, but any name can be used. Other similar codes are illustrated by: iw = winio@("%qf[X]", X) !double precision X
iw = winio@("%qs[STR]", STR) !character variable STR
iw = winio@("%qc[CB]", CB) !callback function CB
iw = winio@("%qh[HWND]",HWND) !Microsoft HANDLE HWND
iw = winio@("%12qd[ARR]",ARR) !an array of integers ARR(12)
iw = winio@("%*qd[ARR]",N,ARR) !an array of integers ARR(N)
iw = winio@("%12qs[STR]", STR) !a character variable array STR(12)
iw = winio@("%*qs[STR]", N,STR) !a character variable array STR(N)
When designing, you will be able to link to any of the variables that have been predefined in this way. In addition you
can link to any images that are already present in an associated .rc resource script (or the RESOURCES block of the FTN95
code).
You can test a design without exiting design mode. Use the accelerator key Ctrl+T in order to run another instance of the application in its finished (not designing) state. The new instance will start up on top of the design window. Be careful to shut down the test before going back to designing. When designing, you can allocate a popup menu to a given control. For this purpose, a new mechanism is provided for defining a menu via calls to winio@... %qi defines a named menu item together with its caption, callback and other attributes. %qm takes a list of these names and
groups them together to form a popup menu. Adding a grave accent, %`qm, allows you to provide a caption to the list with the
result that a popup menu becomes a "submenu". %qm can then be used to form the various kinds of menu that are needed as
illustrated here:
The name #pm in %qm[#pm] is reserved and used to define the main popup menu (cf. %pm). The name #sm in %qm[#sm] is reserved and used to define the systems menu add-on (cf. %sm). The name #rm in %qm[#rm] is reserved and used to define the systems menu replacement (cf. %`sm). A main menu can be defined like this:w = winio@("%`qm[sm1]&", "File", "iOpen,|,iExit")
%`qm[sm1] provides a submenu, with name sm1, caption "File", and item list "iOpen,|,iExit".
The pipe symbol "|" provides a menu separator.
#mn is the reserved name for the main menu constructed from the list "sm1,sm2" of submenus (cf. %mn (Menu)).
Enhanced menu are available as before by using %em (Enhanced Menu) and by adding the name of an icon to a menu item caption. Dynamic menus (where items are added at runtime by calling add_menu_item@) are constructed by using a %qi item name that
begins with an asterisk. For example the following uses the name *Extn:
Some additional points:
|
|||||||||||||||||||||||||||
See also |
||||||||||||||||||||||||||||
Notes |
Added to FTN95 at version 8.20 |