From the Edge: Understanding Custom Form Actions in R:BASE 7.1 for Windows
Section: Forms and Form Designer
Chapter: Running R:BASE Your Way!
Platform: R:BASE 7.1 for Windows
Build: 7.1.71.303xx and higher

R:BASE 7.1 for Windows Form Designer also includes the option of
Custom Form Actions. Now you can build a library of your favorite
commands and use them on demand when necessary. The entire code in
your Custom Form Actions is tightly integrated within the form
itself and will not affect anything during form runtime. Copying
or duplicating the form will carry over the entire code and actions
within the form as well.

The entire idea behind this very cool and powerful feature is the
ability to build entire code related to the form. In this way you
do not have a separate EEP to keep track of.  Anything needed by
the form is packaged with it.

On Start Custom Command could clear and set any needed variables
so the form would always have them available when the form is used
(or Edited). On Close Custom Command could clear variables, RECALC,
and perhaps even QUIT TO. Saving these commands within a form would
function almost as a stored procedure for a form. Whenever the form
opened, it would have the necessary variables and settings. Whenever
it closed, the housekeeping would be done automatically. And there
would not be an EEP which might be edited or forgotten to impair the
operation of the form.

Once Custom Form Actions are defined and saved within the form, you
can call any action by simply using the PROPERTY command in an EEP
as custom or embedded command.

Syntax:

PROPERTY RBASE_FORM_ACTION <CustomFormActionCommandName> <parameter>

Where:

CustomFormActionCommandName is the actual name of the Command Name
assigned when designing Custom Form Action.

Parameter is the optional value you can pass onto the calling command,
if required. Use '  ' blank space with single or double quotes
(depending on your database QUOTE settings), if parameter is not
required in calling command block.

Steps:

01. While in Form Designer, select Custom Form Actions from the form
    Layout menu.

02. Using Action Designer, assign a unique command name for each
    command along with action Description to each action. Click on
    [Add] button to add that action to the list.

03. Highlight the desired action and click on [Edit Command] button
    to bring up the R:BASE Editor to write the code. While in RBEDIT,
    you may use [Open] button on the RBEDIT tool bar to import
    external code to be saved as Custom Form Action.

Click on [OK] button to save action.

Repeat the same step for each Command Name assigned in Step 02.

    If you change the Command Name or Description, make sure to click
    on [Change] button to save changes.

04. Click on [OK] button to save your work and close Action Designer.

Now you have a form with your own Custom Form Actions to be recycled
upon will. All you need is the following PROPERTY command to call
Custom Form Action (as defined See figure 1 through 15).

Now, we have three Custom Form Actions, namely:

� MyPAUSECommand
� MyDIALOGCommand
� MyPRINTCommand

To call MyPAUSECommand in an EEP, use the following PROPERTY command:

        PROPERTY  RBASE_FORM_ACTION  MyPAUSECommand  '  '
        RETURN

To call MyDIALOGCommand in an EEP, use the following PROPERTY command:

        PROPERTY  RBASE_FORM_ACTION  MyDIALOGCommand  '  '
        RETURN

To call MyPRINTCommand in an EEP, use the following PROPERTY command,
assuming that you would like to print the report, for example,
CustomerYellowPages as an HTML document.

        SET VAR vReportName TEXT = 'CustomerYellowPages'
        PROPERTY  RBASE_FORM_ACTION  MyPRINTCommand  'HTML'
        RETURN

The last parameter 'HTML' in PROPERTY command will be passed on to
MyPRINTCommand, required for the SWITCH option.

A PDF document with all details and graphical presentation is also
available at:

From The Edge: http://www.razzak.com/fte (Powered by R:PHP)

Enjoy and make sure to have fun!

Very Best R:egards,

Razzak.



Reply via email to