Use CTLOP_INFO to query the details of a control by its ctlid. This is mainly useful in three kinds of situations:
• | You need to determine if a control (with a specific ctlid) still exists (perhaps upon return from a subroutine that may or may not have cleared the screen). |
• | You have a ctlid—perhaps returned from AUI_EVENTWAIT—but your program does not keep track of controls by their ctlids, so you need to find out more information about the control to decide what to do. |
• | You have a ctlid and you know what control it is, but the control has changeable text and you want to determine what text is currently associated with the control. This would mainly apply to a control designed to be modified by the user (such as an edit control), and in that case, you would probably use INFLD and keep track of the text a different way, but this capability may be useful in an advanced situation. |
To query a control, you need to specify the ctlid. The contents of all the other parameters are ignored on input, and are returned with updated values based on the control specified. If the control exists, cstatus will be set >= 0. If the control is not found, it will set to –2. Other negative values correspond to errors (see cstatus above for a table of error codes). You must specify at least the parameters up to cstatus (and it must be a real variable); all others are optional (but will be updated if passed).
Comments
Beginning with A-Shell 1751 of November 2023: when used on a TABX control, CTLOP_INFO returns the current panel number (starting from 1) in the cstatus parameter if the control is found. Previously it returned the control id. This affects only the Windows client (or ATE), not the server side. Also, the current panels' command string will be return in the ctext parameter.
Example
ctlid = "btnTest" ! id of control to query
xcall AUI, AUI_CONTROL, CTLOP_INFO, ctlid, ctext, cstate, ctype, cmd, func, cstatus, srow, scol, erow, ecol
if cstatus >= 0 then
! control exists; ctext, cstate, etc. will be updated
else
! control does not exist
endif
History
2023 November, A-Shell 1751: When used on a TABX control, CTLOP_INFO returns the current panel number (starting from 1) in the ctext parameter if the control is found, and the current panel's command string in ctext.