DroidDB Tip of the Month
DroidDB® Tip for November 2011
Warning the User That There Are No Records
When a DroidDB application is running but there are no records in the underlying table, DroidDB does not allow the user to enter data into the controls (since there would be no where to save the data entered). This can be frustrating for the user because they might not realize they need to first create a record before entering any data.
We accomodated this situation in the sample Expenses application. When the sample Expenses application comes up the first time, the user sees the message "Currently there are no records. Select MENU | RECORD | INSERT to create a record before entering data". This message is not put up automatically by the DroidDB runtime system, it is put up by a startup macro in the form.
To create this macro:
- Open the DroidDB development environment. Choose your application and open the form.
- Select EDIT | MACROS/EVENTS
- Create a new macro called STARTUP. It will have three steps:
-
Step 1: SKIP if @count = 0 then 0 else 1
Step 2: MESSAGE BOX 'Currently there are no records. Select
MENU | RECORD | INSERT to create a record before entering data'
Step 3: RETURN FROM MACRO - Click the EVENTS button
- Set the On Startup event to STARTUP. Click OK.
- Click CLOSE to close the macro editor.
- Select FILE | SAVE to save your work.