Register to post in forums, or Log in to your existing account
 

 Related 
Contents
Core Library
  ExecWindow
  AddAutoUpdate
  Recalc
  Eval
  Exec
  StartWait
  EndWait
  Version
  AddControl
  FindControl
  ExecuteAction
  AbortAction
  OpenWindow
  ReadIni
  WriteIni
  FlushIni
  CreateObject
  MsgBox
  Prompt
  Confirm
  ThemeIndex
  Theme
  PromptConnection
  ParamCount
  Param
  OptionExists
  OptionValue
  OptionCount
  Die
  Path
Related Links:
  Query
  AddControl
  CreateObject
  Editor Demo
AddControl [[Core.AddControl]] 
NOTE: This Design document is subject to change at any time.
AddControl(ClassName: Widestring; ControlName: Widestring; Parent: WideString): Variant


This function allows you to create a new zApp object from within a script. The new object has the class name (tag) of ClassName and object name of ControlName and is created as a child of the Parent object.

For example, if we have a panel called "ButtonPanel" and we want to add a new button to this panel called "Test", we could use the following code:
Code:
<SCRIPT>
  Set Button = core.AddControl("zButton", "Test", "ButtonPanel")
  Button.Caption = "Test Button"
</SCRIPT>

Since AddControl returns an Object, you must use the 'Set' syntax in VBScript. Other scripting languages will vary. The ClassName is the zApp Object class with the 'z' added to the beginning of it. Once AddControl returns the new button object, you can then set it's properties as expected, like the Caption is set in the above example.

The above example would the the same as the following normal zApp code:
Code:
<PANEL Name="ButtonPanel">
  <BUTTON Name="Test" Caption="Test Button"/>
</PANEL>

which creates the Test button within the ButtonPanel.

Using AddControl you can create a user interface dynamically without having to rely on the ZML user interface file.
Viewer Comments [0 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net