Additional
Menu and Browse Entries
1. Introduction
The UNIFACE Development Environment is
itself written (at least largely) in UNIFACE. Leaving aside the
'chicken and egg' question, this allows us to customise it and add
our own UNIFACE code. In UNIFACE 5 and 6, if we wanted to add our
own code we had to replace one of the UNIFACE development forms with
our own code, by using an assignment file trick. (see previous tip
of the week). UNIFACE Seven allows us the ability to add our own
menu options more easily.
2. Create the Menu
To add the menu options create a drop
down menu called ADDITIONAL in the library USYS. These menus can
contain any of the functionality you would normally include.
In this example, there are 3 menu
options, one to perform the version Six browse entries function, one
to invoke debug and one to generate the code for a while loop, based
on the text under which the cursor is positioned.
3. Set the Preference
Having created, and compiled the menu,
you may need to set the preference that you want to actually use it.
Select: Utilities, Preferences, General
4. UNIFACE Six
In UNIFACE Six, when editing proc code
in the trigger editor, a button existed to allow the developer to
get a list of entries, in the current trigger. This was particularly
useful in the local proc modules trigger.
Figure 5: The Browse Entries button.
When you pressed 'OK' the cursor was
repositioned on the highlighted entry.
5. UNIFACE Seven
In UNIFACE Seven, this functionality
has been removed! To alleviate this problem, we have created a
UNIFACE form, which takes a single parameter, in $1, which is the
trigger code. It analyses the code and produces a list of
entries.The user can select the entry, by double clicking on the
fields, or pressing the OK button. When selected the cursor is
repositioned on that entry. The functionality has been enhanced, to
not only identify local proc routines, but also UNIFACE Seven
operations. Sort functionality is provided, using the header bars,
to either sort by name or line number. The repositioning is done
using the macro statement to move the cursor down the required
number of lines.It relies on the cursor being correctly positioned
in the field with the proc code.
6. Installation
If you do not have an existing
additional menu:
- Import the supplied TRX,
/imp browse.exp
- Compile the menu e.g.
/men usys from
the command line
- Compile the form Browse
/frm browse from
the command line
The additional menu should now be
available.
If you have an existing additional
menu:
- Add a menu item
With the following code in the option trigger:
call Macro_First_text
if ($fieldname = "TREE")
$1 = DummySS.Dummy1
else
$1 = @$fieldname
endif
run "BROWSE"
;-----------
entry Macro_First_Text
;--------------------
macro "^FIRST_TEXT"
- Import the TRX browseform.exp
/imp browseform.exp
- Compile the form
/frm browse
The additional menu should now be
available.
|