home *** CD-ROM | disk | FTP | other *** search
-
-
- !Examples application
-
- (C) Petrov Software 1992
-
-
-
-
- Purpose
-
- The purpose of this application is to illustrate the use of MenuUtils
- module in BASIC programs. When run !Examples starts up several
- examples as independent Wimp tasks. Module MenuUtils may be found
- inside !Examples directory.
-
-
- Description of examples
-
- All examples are contained in directory Examples inside !Examples
- application. Their names are "Ex1", "Ex2", ... Each program
- illustrates different aspects of using MenuUtils module.
-
- All examples are written in BASIC. Functions and procedures common for
- all examples are placed in special "Library" file (description of the
- file is bellow).
-
- After startup all programs place their icons on Iconbar. To see the
- corresponding menu click with Menu button over the icon. To quit the
- program select "Quit" item.
-
- "Ex1"
-
- This program creates the simplest menu consisting of a single item
- "Quit". After registration as the Wimp task the program calls
- MenuUtil_Initialise to register itself as MenuUtils client. Then the
- program calls MenuUtil_New to start creation of the menu and then
- MenuUtil_Add to add the single menu item. Look how to attach item
- handler. When menu creation is finished the program enters Wimp_Poll
- loop. Inside the loop the program answers only to three reason codes:
- mouse click, menu selection and message (quit message is received when
- user selects "Quit" from Task Manager's menu). Mouse click reason code
- is returned when user clicks with mouse over the program's iconbar
- icon. The program checks if the click is with Menu button and displays
- menu on screen using MenuUtil_Show. Menu selection reason code is
- returned when user selects from the menu. To find out what is selected
- the program calls MenuUtil_Decode. This call returns the pointer to
- item handler if the "Quit" item is selected. In this case the program
- reads the name of the handler and then calls it.
-
-
- "Ex2"
-
- This program illustrates the use of dialog boxes. Menu of this program
- consists of two items "Info" and "Quit". After initialisation the
- program creates a window which will be used as a dialog box. After
- "Info" item is created the program calls "MenuUtil_SubMenu" to link it
- with the dialog box. An arrow will be displayed to the right of the
- item. And if the user moves the mouse pointer over this, then "About
- this program" window automatically pops up. If user selects something
- from menu with Adjust button then it will be detected by
- MenuUtil_Decode and the program calls MenuUtil_Show to reopen menu on
- the same place.
-
- "Ex3"
-
- This program illustrates the use of colour setting menu. Main menu
- consists of three items "Info", "Colour" and "Quit". The program calls
- MenuUtil_ColourMenu to create standard colour setting submenu. And
- then MenuUtil_SubMenu to link it with "Colour" item. The program
- attaches one common handler to all items of submenu. This handler will
- be called when user selects any item in the submenu. The position of
- selected item (not the item handle) is taken from the block returned
- by MenuUtil_Decode. Then MenuUtil_TickOnly is called to tick selected
- item. The program also calls MenuUtil_Colours to change the colours of
- "Colour" item as is done in "!FormEd" application.
-
-
- "Ex4"
-
- This program illustrates the use of writable menu items and also
- insertion and deletion of menu items with help of MenuUtils module.
- Main menu consists of three items "Info","*Command" and "Quit".
- "*Command" item is linked with "Command" submenu which at the
- beginning consists of a single item. The program calls
- "MenuUtil_Writable" to make this item writable. User can enter RISC OS
- command here. If user selects this item then corresponding item
- handler will be called. The handler executes the command and also
- remembers it by adding an item to the submenu. Now user can repeat the
- command by selecting new item. Each new item is linked with "Delete"
- submenu what allows to delete not needed items.
-
-
- "Library"
-
- This file contains functions and procedures common to all examples.
-
- PROCinit(task$) registers the program as Wimp task, opens common
- templates file and places icon on iconbar.
-
- FNwindow(window$) loads window definition from templates file and
- creates the window. Function returns the handle of the window.
-
- PROCinit("") closes templates file.
-
- PROCquit calls Wimp_CloseDown and quits the program.
-
- PROCmessage calls PROCquit if the message is "quit".
-
-
-
- -----------------------------------------------------------------
- Notes from the author
-
-
- MenuUtils is freeware software. Everybody is free to use MenuUtils
- module, even in commercial code. In case of commercial use I would
- like to know this in advance (I could than provide you with the latest
- release). You can always contact me if you found some bug, or when
- having other suggestions.
-
- To contact the author of MenuUtils, please write to:
-
- RUSSIA
- 115541
- Moscow
- Kavkazsky boulevard, 29
- Bld. 1, Flat 107
- Alex Petrov
-
- E-mail: APetrov@misis.msk.su
- APetorv@arm.msk.su
-
- FIDO: 2:5020/104.13
-
- phone: +7 095 322 2098
- fax : +7 095 236 8350
-