6. Working with Arrays, Table Fields, and Collections : Table Field Operations : Controlling Multiple Table Fields with a Single Control Button
 
Share this page                  
Controlling Multiple Table Fields with a Single Control Button
You can use one control button to provide operations for multiple table fields. In fact, if you have multiple table fields on a frame, it is necessary to use a single ControlButton so that the Control Button accelerator keys will be applied to the table field that currently has input focus. Assume you have a frame with two table fields, for example:
Checkouts
This table field tracks DVDs as they are checked out and in by each customer.
Reservations
This table field tracks reservations held by customers for specific DVDs.
As customers check out a DVD, they also can reserve another disc.
You could add operations to the control buttons provided by default with each of these table fields. However, to reduce duplication of code, you can write generic code for operations common to both table fields and provide a single control button for both.
Independent control buttons are created with no menu operations. To include the standard table field operations (Insert Before Current Row, Delete Current Row, and Delete All Rows) that are provided by default with every table field control button, you can copy the 4GL code for these operations into the independent control button. You can find this code using View Processed Script in the Frame Editor. These three default table field operations are excellent examples of coding table fields generically.