This scenario is part of Actions Example 12: Generic Search Dialog.
To get a dialog that can act as a generic toolbar and function with ANY calling window:
1. | Create a new subclass of the Dialog Box class, rename it to SearchDialog. |
| Rename and adapt your FindExistingReservations Dialog (Example 11) into this newly defined SearchDialog. |
2. | In the Controls Group, insert a text box with prompt: Destination, and set the Related Column property to: |
TOUR.DESTINATION
| A lookup button will appear that calls a lookup window for Tours. |
3. | Insert a text box with prompt: Customer Name, and set the Related Column property to: |
PERSON.FAMILY_NAME
4. | Rename the OK and Cancel buttons to "Find" and "Close" respectively, and reposition them if required. |
5. | In the Object Activator for the Action property of the Find button, remove the dialog-ok() action, and create the following user-defined properties: |
Property Name
|
Type
|
Argument Position
|
TheBoxToQuery
|
Info Window
|
1
|
ConditionDestination
|
BaseColumn
|
2
|
ConditionCustomer
|
BaseColumn
|
3
|
|
| Make sure to select the SearchDialog in the Object Browser tree view (top-left) while defining those properties. Note that the first property is no longer of the Reservations type (like in example 11), but the more abstract Info Window type. The other two properties have the BaseColumn as the type which can refer to the query columns in another table. Note that instead of BaseColumn, you can also use the OUTPUT_COLUMN type with the same result. |
6. | Still in the Object Activator for the Action property of the Find button, continue writing the following script: |
theBoxToQuery.QueryDefine() )
conditionDestination.value(Variables.Text_Box_1() )
conditionCustomer.value(Variables.Text_Box_2() )
theBoxToQuery(QueryExecute() )
| In the second and third line, you need to be specific about the Value property to avoid type mismatch. |
7. | Click Apply and OK to save your work and close the Object Activator. |
See Next
Reservations Window
|