DroidDB Tip of the Month

DroidDB® Tip for September 2016

Preventing the End-User From Moving From One Tab to Another

If your form has multiple tabs, you may want to force the user to complete one tab before going to the next. It's a bit tricky, but it can be done.

There are four features in DroidDB's form designer that you can use to do this:

  1. If you select EDIT | MACROS/EVENTS and then click the EVENTS button, you will see a dropdown labeled "On Startup". Here you can select a macro to run when the end user first runs the form.
  2. If you select EDIT | MACROS/EVENTS and then click the EVENTS button, you will see a dropdown labeled "On Select Tab". Here you can select a macro to run when the end user selects another tab.
  3. In an expression, you can use the function @currenttab to determine the currently selected tab (0 for the first tab, 1 for the second, 2 for the third, etc.).
  4. A step in a macro can be "Select tab" which, when executed, will force a particular tab to be dislayed.

First, create a form in the form designer you want to put this feature into:

  1. Select FILE | NEW FORM. When asked if the form has an underlying table, select NO.
  2. Select FORM | TABS
  3. Click ADD BEFORE and give the tab the name "Tab A" (without the quotes). Click OK
  4. Click ADD AFTER and give the tab the name "Tab B" (without the quotes). Click OK
  5. Click OK
  6. Select CONTROL | CHECKBOX. When asked to select a column or variable, select @var(34). Click OK.
  7. Set "Text" to "Click me" (without the quotes) and click OK to close the properties dialog.
  8. Drag the checkbox control to the center of the form

What we want to do is to disallow the user from going from Tab A to Tab B unless the Click Me checkbox is checked.

To do this, here's what you have to do in the form designer:

  1. Select EDIT | MACROS/EVENTS
  2. If not prompled for the name of a macro, click NEW
  3. In the Macro Name dialog, set the name to "MyStartup" (without the quotes) and click OK
  4. Click ADD BEFORE
  5. Change "Record | Close" to "Assign"
  6. For "Value", specify "@currenttab (without the quotes); for "Col", specify "@var(35)" (without the quotes).
  7. Click the "Events" button
  8. In the On Startup dropdown, select "MyStartup". Click OK
  9. Click NEW
  10. In the Macro Name dialog, set the name to "MySelectTab" (without the quotes) and click OK
  11. Click ADD BEFORE
  12. Change "Record | Close" to "Skip"
  13. For "Num", specify "if @var(34) then 0 else 2" (without the quotes).
  14. Click ADD AFTER
  15. Change "Record | Close" to "Assign"
  16. For "Value", specify "@currenttab (without the quotes); for "Col", specify "@var(35)" (without the quotes).
  17. Click ADD AFTER
  18. Change "Record | Close" to "Skip"
  19. For "Num", specify "2" (without the quotes).
  20. Click ADD AFTER
  21. Change "Record | Close" to "Select tab"
  22. For "Num", specify "@var(35)" (without the quotes).
  23. Click ADD AFTER
  24. Change "Record | Close" to "Message box"
  25. For "Msg", specify 'Please check the checkbox' (WITH the quotes).
  26. Click the "Events" button
  27. In the On Select Tab dropdown, select "MySelectTab". Click OK
  28. Click CLOSE
  29. Click FILE | SAVE and save your form

 

Back to List »

Visit our store

Top rated! I needed a solid database application development tool for mobile devices. I chose DroidDB for Android OS because it provided a way to get a strong product to market quickly. DroidDB is relational, gives me control over form layout, handles macros, and supports events. It works on all Android versions I have tried and is a great companion product to SYWARE’s VisualCE.

Mark Read, President
SyntegraTech, Inc.

signup for our newsletter