%AX_TKCALL

Call a method for an ActiveX control

WSupported on Windows

 

 

 

value = %AX_TKCALL(tk_container_id, method_name[, arguments, ...])

or

xcall AX_TKCALL(tk_container_id, method_name[, arguments, ...])

value

The value returned by the method on Windows in traditional Synergy. If the method returns a value that isn’t meaningful when expressed as an integer, value is returned as zero, and the value returned by the method is ignored. On Unix, a call to this routine will cause an error. On OpenVMS, this routine always returns true. (^VAL)

tk_container_id

The window ID for the ActiveX control’s Toolkit container. (n)

method_name

The name of the method to call. (a)

arguments

(optional) Up to nine arguments to be passed to the method. (See the Discussion for information on passing more than nine.)

%AX_TKCALL enables you to access an ActiveX control’s methods by passing the Toolkit container ID. (If you use %AX_CALL, you must pass the control ID.) Note the following:

Because %AX_TKCALL is a macro, you can pass more than nine arguments by grouping arguments together using angle brackets (< >). If you enclose all optional arguments in a single set of angle brackets, the macro expansion will treat the enclosed text as a single unit.

%AX_TKCALL will attempt to convert all optional arguments into the type of data that the method expects. You must ensure that the type of data passed has meaning within the context of the targeted conversion. Failure to do so will yield undefined results. For more information, see ActiveX data types.

Tip

If you make multiple method calls to the same control, use %AX_TKCTLID to get the ActiveX control ID, and then use AX_CALL to call the methods. %AX_TKCALL is convenient (because you don’t need the control ID), but it calls AX_CALL, so it’s not as efficient.

The following example uses %AX_TKCALL to display the About window for the control when the O_ABOUT menu entry is selected. It also displays two messages when the O_DBLCLK menu entry is signaled.

proc
    xcall u_start
    xcall mb_column(cntrl, "Col", "General")
    xcall mb_entry(cntrl, "o_about", "About")
    xcall mb_line(cntrl)
    xcall mb_entry(cntrl, "o_exit", "Exit", F4_KEY)
    xcall mb_end(cntrl, col_id)
    wndid = %grid_create(10, 40, D_SPREAD_LICENSE, "tgrid_")
    xcall u_window(D_PLACE, wndid, 10, 21)
    xcall ax_tkset(wndid, "VirtualMode", TRUE)
    xcall ax_tkset(wndid, "VirtualRows", 100)
    xcall ax_tkset(wndid, "MaxCols", 5)
    repeat
      begin
        xcall ax_input(wndid)
        if (g_select)
          begin
        using g_entnam select
("O_DBLCLK "),    xcall u_message("Double-clicked row " +
             &          %string(%ax_tkgetint(wndid, "ActiveRow"))+
             &          ", column " +
             &          %string(%ax_tkgetint(wndid, "ActiveCol"))+
             &          "\n\n   using %ax_tkgetint call")
("O_ABOUT "),    xcall ax_tkcall(wndid, "AboutBox")
("O_EXIT "),     exitloop
(),            exitloop
        endusing
          end
      end