Table 20-2 shows the actions you can assign to a button in a DataWindow object. Each action is associated with a numeric value (the Action DataWindow object property) and a return code (the actionreturncode event argument).
The following code in the ButtonClicked event displays the value returned by the action:
MessageBox("Action return code", actionreturncode)
Action |
Effect |
Value |
Action return code |
---|---|---|---|
User Defined (default) |
Allows the developer to program the ButtonClicked event with no intervening action occurring. |
0 |
The return code from the user's coded event script. |
Retrieve (Yield) |
Retrieves rows from the database. Before retrieval occurs, the option to yield is turned on; this will allow the Cancel action to take effect during a long retrieve. |
1 |
Number of rows retrieved. -1 if retrieve fails. |
Retrieve |
Retrieves rows from the database. The option to yield is not automatically turned on. |
2 |
Number of rows retrieved. -1 if retrieve fails. |
Cancel |
Cancels a retrieval that has been started with the option to yield. |
3 |
0 |
Page Next |
Scrolls to the next page. |
4 |
The row displayed at the top of the DataWindow control when the scrolling is complete or attempts to go past the first row. -1 if an error occurs. |
Page Prior |
Scrolls to the prior page. |
5 |
The row displayed at the top of the DataWindow control when the scrolling is complete or attempts to go past the first row. -1 if an error occurs. |
Page First |
Scrolls to the first page. |
6 |
1 if successful. -1 if an error occurs. |
Page Last |
Scrolls to the last page. |
7 |
The row displayed at the top of the DataWindow control when the scrolling is complete or attempts to go past the first row. -1 if an error occurs. |
Sort |
Displays Sort dialog box and sorts as specified. |
8 |
1 if successful. -1 if an error occurs. |
Filter |
Displays Filter dialog box and filters as specified. |
9 |
Number of rows filtered. Number < 0 if an error occurs. |
Delete Row |
If button is in detail band, deletes row associated with button; otherwise, deletes the current row. |
10 |
1 if successful. -1 if an error occurs. |
Append Row |
Inserts row at the end. |
11 |
Row number of newly inserted row. |
Insert Row |
If button is in detail band, inserts row using row number associated with the button; otherwise, inserts row using the current row. |
12 |
Row number of newly inserted row. |
Update |
Saves changes to the database. If the update is successful, a Commit will be issued; if the update fails, a Rollback will be issued. |
13 |
1 if successful. -1 if an error occurs. |
Save Rows As |
Displays Save As dialog box and saves rows in the format specified. |
14 |
Number of rows filtered. Number < 0 if an error occurs. |
Prints one copy of the DataWindow object. |
15 |
0 |
|
Preview |
Toggles between preview and print preview. |
16 |
0 |
Preview With Rulers |
Toggles between rulers on and off. |
17 |
0 |
Query Mode |
Toggles between query mode on and off. |
18 |
0 |
Query Sort |
Allows user to specify sorting criteria (forces query mode on). |
19 |
0 |
Query Clear |
Removes the WHERE clause from a query (if one was defined). |
20 |
0 |