The GeekZone

DroidDB® Macros and Events

DroidDB has a Macro Programming capability. A Macro Program is defined as a sequence of commands that are executed, one at a time. Macro Programs are invoked when (a) the user clicks a button on the form, or (b) an event occurs (such as a value changed or a control gets or loses focus).

Each command step in a macro can do one of many things:

Menu Command
Performs a menu command from within a macro program. Any menu command can be handled this way.

Run Form
Launches another DroidDB form.

Run External
Some other application.

Generates a report about the current record or all records.

Launches another DroidDB form and positions to a related record in that form.

Puts up a message box on the screen with a message you specify, plays a system sound, or plays a pre-recorded sound.

Assigns a value to a column or global variable. The value can be an expression (the same type of expression that you specify in a calculated control).

Skips forwards or backwards in the Macro Program. You specify a specific place in the macro to go to. Alternatively, you specify the number of commands you want to skip (positive values skip forward, negative values skip backwards) as an expression (the same type of expression that you specify in a calculated control). An if...then...else can be used to control where to skip to (the condition can depend on the current values in the record).

Turn record filters on or off.

Reads a barcode into a column of the table or a global variable.

Reads a NMEA GPS signal into a column of the table or a global variable.

Synchronize the handheld over a wireless network.

Import/Export of text files.

Delays the execution of a Macro Program for a specified number of seconds.

Change sort/search order
Changes the order of the records in the table.

Run a sub-macro
Run another macro and then continue with this one.

Set Timer
Sets a timer to run a macro at a later date/time.

Sends an SMS text message or opens a form when an SMS test message is received.

Show/Hide control
Show or hide a control.

Set focus
Set focus on a control.

Dial a phone.

Select Tab
Control the tab that is selected.

Things you can do with Macro Programming:

  • If you are building a questionnaire, you can have a button that sets a checkmark (for example, gender) and then moves to the next appropriate set of questions.

Assign “Male” to Gender

Move to tab with “Male” questions

Return from macro

  • You can add integrity constraints: test to make sure a value is in range and if not, display an error:

Skip button: if age >= 0 go to Continue

Put up an error message

Return from macro


Save the record

Return from macro

  • You can add an event to a dropdown that gets triggered when the value in the dropdown changes. If you have a "Gender" dropdown, this could be used to hide/show a "Pregnant?" checkbox:

Skip button: if Gender = 'Male' then 2 else 0

Show "Pregnant?" checkbox

Return from macro

Hide "Pregnant?" checkbox

Return from macro

Bear in mind that this is a macro capability that is running on a handheld device. If you need to do significant record processing, it would be better to do this using some other tool on the desktop.


Events are generally (but not always) actions initiated by the user. You can associate a macro with an event, so that when the event occurs, the macro runs automatically.

DroidDB supports the following events:

A control gets/loses input focus.

The value in a control was changed by the user.

Record Display
The form is moved to a record.

Leave Record
The form is moved from a record.

The form is starting.

Select Tab
The selected tab has changed.

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