mobile databases, mobile forms, and mobile synchronization … where you need to work
Providing Pocket Access, Mobile Database, Windows CE Database, and Windows CE Development Solutions

Tip of the Month (March 2010)

Running a macro or jumping on a tab click

When the end user clicks on a tab, normally they see the controls on that tab. But, perhaps you might want a macro to run or perhaps you might want to jump to another form. This is simple to set up.

To handle tabs this way, you will make use of two Visual CE features:

  • When the user clicks on a tab, the "On Select Tab" form event is fired.
  • The expression @currenttab can be used to determine which tab is selected (it returns 0 for the first tab, 1 for the second tab, etc.)

Say you had three tabs in your form. For each tab, you create a macro (TAB_0_MACRO, TAB_1_MACRO, and TAB_2_MACRO) that is to be run when the user selects the tab (if you just want the tab selection to display the tab and not do anything else, just hve TAB_x_MACRO do a RETURN FROM MACRO and nothing else).

Then create a macro called TAB_MACRO as follows:

    Step 1: SKIP (Num: @currenttab * 2)
    Step 2: RUN MACRO (Macro: TAB_0_MACRO)
    Step 3: RETURN FROM MACRO
    Step 4: RUN MACRO (Macro: TAB_1_MACRO)
    Step 5: RETURN FROM MACRO
    Step 6: RUN MACRO (Macro: TAB_2_MACRO)
    Step 7: RETURN FROM MACRO

Lastly, set the "On Select Tab" form event to run TAB_MACRO.

If, when the user clicks a particular tab, you want to JUMP instead of running a macro: don't create the TAB_x_MACRO and use a JUMP (rather than a RUN MACRO) for that tab in TAB_MACRO.


Previous Tips of the Month