Programming the Tool Bar - Ultramarine.com Programming the Tool Bar

The MOSES Tool Bar is a set of buttons at the top of the display area which, when pushed, drop down another set of buttons. Each of these buttons represent either another drop down set of buttons, or a command. The entire system is user programmable with a command and "STRING" macros. The basic command here is:


     &MENU,  ACTION, NAME, TITLE(1), RETURN(1),  ...

Here, ACTION is the action which must be either CREATE, DELETE, or ADD, NAME is the name of the menu, RETURN is the "return string". Of course, the last two items are required for each line in the menu.

The NAMEs associated with menus are up to the user except the one T_BAR which is the name of the Tool Bar itself. Normally the only action one needs is CREATE, but with T_BAR, one can ADD a menu to it, or DELETE one he has added. The TITLE(i) are the strings which are printed on the buttons. For the Tool Bar itself, these are best left short as the real estate is limited. Remember here if you have spaces in any thing, you need to enclose them in either " or ' pairs.

Now, RETURN(i) can be either: the name of another menu, the name of a &STRING macro, or a true return string. Let us look at an example. Suppose that one wanted to add a button to the Tool Bar to set the dimensions to meters. This can be accomplished with

     &MENU,  ADD , T_BAR DIM2M '&DIMEN -D METERS TONNES'

Now, when you push this button, the dimensions will be changed to meters and tonnes. Suppose, however, that you sometimes wish to use kilo-newtons? To allow for this, you must interact with the user and a &STRING macro is required. The following:

     &STRING D2M
     &DIMEN -D METERS &GET(PICK 1 'FORCE UNIT' TONNES KN)
     END
     &ENDSTRING
     &MENU ADD T_BAR DIM2M D2M

Now, when one pushes the DIM2M button, it will execute the &STRING macro D2M. In here, the user is asked to choose the force unit he wants to use.

The entire Tool Bar structure used in MOSES can be investigated in the file /ultra/data/progm/moses.mac.