In this example, we will add a button to a property sheet tab, to open a dialog box, allowing you to enter additional personal details for a person.
- Open the Personal Details form under the Person metaclass, and select Dialog Box in the Type field, to transform it from a property sheet tab into an independent dialog:
- Right-click the Person metaclass and select . Enter the name ShowPersonalDetails, and then click the Method Script tab and enter the following script:
Sub %Method%(obj)
' Show custom dialog for advanced extended attributes
Dim dlg
Set dlg = obj.CreateCustomDialog("%CurrentTargetCode%.Personal Details")
If not dlg is Nothing Then
dlg.ShowDialog()
End If
End Sub
- Select the Contact Details form, and click the Add Method Push Button tool, select the ShowPersonalDetails method, and then click OK to add it to the form. Here, I use a horizontal layout and spacer to align the button with the right edge of the form:
- Enter Personal... in the Label field, and then click OK to save your changes and return to the model. Now when you open the property sheet of a person, the Contact Details tab contains a Personal... button which opens the Personal Information dialog: