Chapter 4 Extending your Models with Profiles
You can create a dialog box when you need to enter parameters during OLE automation through VB scripts.
In this example, we will create a new dialog box that will be launched from a new "Export command in the contextual menu of extended objects, and which allows you to enter a path to where the extended object should be exported.
To create the dialog box:
Sub %Method%(obj) ' Exports an object in a file ' Create a dialog to input the export file name Dim dlg Set dlg = obj.CreateCustomDialog ("%CurrentTargetCode%.Export") If not dlg is Nothing Then ' Initialize filename control value dlg.SetValue "Filename", "c:\temp\MyFile.txt" ' Show dialog If dlg.ShowDialog() Then ' Retrieve customer value for filename control Dim filename filename = dlg.GetValue("Filename") ' Process the export algorithm... Output "Exporting object " + obj.Name + " to file " + filename End If ' Free dialog object dlg.Delete Set dlg = Nothing End If End Sub
Copyright (C) 2008. Sybase Inc. All rights reserved. |