Form usage and commands Print this Topic Up One Level

Home > 

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:












 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;




     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://";


© 2019 Altova GmbH