Form usage and commands

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  UModel Programmer's Reference > Scripting Editor > Programming Points > Built-in Commands >

Form usage and commands

Form usage is as follows:

 

 With Form objects, the Form Component Tree can be accessed naturally via field access:

 

 For example, suppose there is a Form designed as follows:

 

         MyForm

                 ButtonPanel

                         OkButton

                         CancelButton

                 TextEditor

                 AxMediaPlayer1

 

         TrayComponents:

                 MyTimer

 

 The Form can then be instantiated from script as:

 

     var objForm = CreateForm("MyForm");

 

 To access one its components the field access can be used:

 

     objForm.ButtonPanel.OkButton.Enabled = false;

 

 or

 

     objForm.TextEditor.Text = "Hello World";

 

 To access Tray Components use the following method on the Form object:

 

     var objTrayComponent = <A form object>.GetTrayComponent(strComponentName : String);

 

 In our example to get a reference to the Timer Component to enable it use the following:

 

     var objTimer = objForm.GetTrayComponent("MyTimer");

     objTimer.Enabled = true;

 

 For ActiveX Controls the underlying COM object can be accessed via the OCX property:

 

     var ocx = lastform.AxMediaPlayer1.OCX; // get underlying COM object

     ocx.enableContextMenu = true;

     ocx.URL = "mms://apasf.apa.at/fm4_live_worldwide";

 


© 2019 Altova GmbH