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 (June 2011)

Positioning to a Region When Opening a Form

When Visual CE opens a form, by default the upper left corner (position 0, 0) of the form is displayed. When launching a form from another form, you may want to be positioned someplace else.

Say you have three regions on your form (region 0, region 1, and region 2). Say that sometimes when the form opens you want to be at region 0, sometimes region 1, and sometimes region 2.

In the form you are jumping from, create a macro with two steps:

    Step 1: Assign 0, 1, or 2 to @var(45)
    Step 2: Jump or Run External

In the form you are jumping to, create a macro with 8 steps:

    Step 1: Skip (if @var(45) = 1 then 0 else 2)
    Step 2: Move-to-when-pressed region 1
    Step 3: Return from macro
    Step 4: Skip (if @var(45) = 2 then 0 else 2)
    Step 5: Move-to-when-pressed region 2
    Step 6: Return from macro
    Step 7: Move-to-when-pressed region 3
    Step 8: Return from macro

Or, better yet, in the form you are jumping to, create a macro with 7 steps:

    Step 1: Skip @var(45) * 2
    Step 2: Move-to-when-pressed region 0
    Step 3: Return from macro
    Step 4: Move-to-when-pressed region 1
    Step 5: Return from macro
    Step 6: Move-to-when-pressed region 2
    Step 7: Return from macro


Previous Tips of the Month