Database Exchange > Runtime interface > Database Exchange ActiveX control - Using Cicode

Database Exchange ActiveX control - Using Cicode

Using the Cicode functions _ObjectSetProperty and _ObjectCallMethod, it is possible to set a property or call a method on the Database Exchange control at runtime.

Example: Setting Properties at Runtime

The following example illustrates how to create two buttons that display and hide the menu bar on the Database Exchange ActiveX control at runtime. The property being set is ShowMenuBar.

Note: This procedure assumes that a Database Exchange ActiveX control has been placed on the graphics page at AN 35

To create a button that displays the menu bar:

  1. Create a new button on the graphics page using the Graphics Builder tools.
  2. Double-click the button to access its properties. Select the Input tab on the top of the dialog and the Touch tab along the right-hand side.
  3. Select the Down checkbox in the Action list.
  4. Paste the following line of Cicode into the Down command window.

_ObjectSetProperty(ObjectByName("AN35"), "ShowMenuBar", TRUE)

  1. Click OK. Pressing this button at runtime causes the menu bar to display.

To create a button that hides the menu bar:

  1. Create a second button, following steps 1-3 above.
  2. Paste the following line of Cicode into the Down command window.

_ObjectSetProperty(ObjectByName("AN35"), "ShowMenuBar", FALSE)

  1. Click OK. Pressing this button at runtime hides the menu bar.

Example: Calling a Method at Runtime

This example shows how to call a method on the control at runtime using the Cicode function _ObjectCallMethod.

  1. Create a new button on the graphics page using the Graphics Builder tools.
  2. Double-click the button to access its properties. Select the Input tab on the top of the dialog and the Touch tab along the right-hand side.
  3. Select the Down checkbox in the Action list.
  4. Paste the following line of Cicode into the Down command window.

_ObjectCallMethod(ObjectByName("AN35"), "DownloadData", -1)

Note: 1 (signifying the currently selected row) is the argument of the DownloadData method.

The result of executing this Cicode is equivalent to clicking on the Select button on the Database Exchange control menu after a row has been selected.

For descriptions of each method, see the full List of Methods.

Note: For more information on the methods _ObjectSetProperty and _ObjectCallMethod, see the Citect Help