Chapter 4 Extending your Models with Profiles


Example: Creating a dialog box to launch from a property tab

In this example, we will continue to work with the Teradata property tab (see Example: Creating a property sheet tab), by creating a dialog box for editing more specific attributes. This dialog will be launched when you click a button on the property tab.

You call a dialog box by invoking a method (see Methods (Profile)). You need first to create the method, and then to add it to the property tab to create a button for calling the dialog.

Steps To create the method to call the dialog:

  1. Right-click the User metaclass and select New→Method.
  2. Name the new method ShowAdvancedExtendedAttributes, 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%.Advanced Teradata Attributes")
   If not dlg is Nothing Then
      dlg.ShowDialog()
   End If
End Sub

  1. Select the Teradata property tab in the ProfileUserForms folder, click the Method Push Button tool in the Form tab toolbar, select the new method, and then click OK to add it to the form.
  2. Enter Advanced... in the Label field, and then click Preview to see the new button at the bottom of the property tab:


    Now we will continue on to create the dialog box

Steps To create the advanced attributes dialog box:

  1. Right-click the Forms category in the User metaclass and select New to create a new form.
  2. Enter Advanced Teradata Attributes in the Name box and select Dialog Box in the type list. Note that additional tools appear in the Form tab toolbar.
  3. Click the Extended Attribute tool in the palette, select the following attributes, and then click OK to add them to the form:
  4. Click the Group Box tool to create a group box control and name it Journal. Then drag the Journal, AfterJournal, and DefaultJournalTable extended attributes into the group box.
  5. Click the Form entry in the controls tree and enter 140 in the Label Space box to ensure that all the controls are aligned. Then click Preview.
  6. You cannot test launching the dialog box in preview mode, so click OK to save your changes and close the Resource Editor. Then, create a user, open its property sheet, select the Teradata tab, and click the Advanced button to launch the dialog box:

 


Copyright (C) 2008. Sybase Inc. All rights reserved.