The "Edit Record" Dialog |
Top Previous Next |
A generic "Edit Record" dialog template is defined that can be used with User-defined Tables (though it could technically be used to create a custom editing dialog for any record type).
To create an Editing dialog for your custom table, you must create a Dialog Definition as an "Add-on" to the dialog type "Edit Generic Record", with the Base Table set to your user-defined table name. It will have the typical browsing functions at the top like Site Details has (Next/Previous, Add, Delete, Print, etc.), which you can optionally enable when invoking it. This uses a standard template so that he browsing controls are handled for you. By default the dialog is only large enough for the top browsing controls, so put in some number (try 500 to start) for the Height to make it taller). Then use Quick-Add fields to add all of the necessary fields from your table, using 80 as the starting top position. Adjust the size and field positions later as needed.
Once you've created that dialog, there are a few functions available to access it:
AddEditRecord
Use this in a Menu definition or from a button on another Dialog definition to add a new record of this type and open your custom Edit Record dialog to enter the data. The only argument is the table name, for instance:
AddEditRecord("Children")
It will return the record that was created (or NullRecord() if it was canceled).
EditRecord
Use this where needed to open your Edit dialog with a known record. For instance in a Query definition, set up a Double-click Action expression with EditRecord(This()). Or you can create a Menu definition using EditRecord(TableRecAt("MyTable",1)) to browse starting at the first record in the table. You can also specify which functions are enabled on the dialog (all are enabled by default, if not otherwise specified). The full syntax is:
EditRecord(rRecord [, bBrowse [, bAllowAdd [, bAllowDelete]]])
ShowRecordList
This will actually show the Record List dialog as explained in that section, but it will use your custom Edit Record dialog if the record is edited from that dialog, just as if EditRecord is called. More details are in the "Record List Dialog" section.
Additional Topics:
Advanced Customizations Overview & other topics