Please enable JavaScript to view this site.

A-Shell Reference

Navigation: Subroutines > MIAMEX

MX_AUTOPARENT

Scroll Prev Top Next More

Rewritten June 2025

xcall MIAMEX, MX_AUTOPARENT, newctrlid {,oldctrlid}

MX_AUTOPARENT (MIAMEX 141) allows you to query and/or set the default AUI parent control, which comes into play in the following circumstances:

Controls are created using AUI_CONTROL without explicitly specifying a parent in the parentid parameter.
Controls are created using TPRINT/DPRINT/EPRINT (which don't offer such an option)
Controls are created by PRINT statements when SET AUTOTPRINT is active
TAB(-1,0), TAB(-1,9) or TAB(-1,10) are used (potentially deleting controls from the parent window)

The main use case is to simplify dialog creation, allowing use of the simpler variations of PRINT statements instead of the more complex AUI_CONTROL calls.

Note that while Groupbox controls (rather than dialogs) are not normally considered eligible default parents, there in an exception for xPRINT statements.  So for example, after creating a groupbox control and setting it to be the default parent control, you can then display text within the groupbox using PRINT TAB coordinates starting from (1,1). (And if you then change the coordinates of the groupbox, the contents will move with it.)

To avoid unexpected side effects, clear the auto parent setting when no longer needed by calling the routine with newctrlid set to 0. It will also be cleared automatically at the start of a new RUN program.

Unless specifically overridden via the parentid parameter passed to AUI_CONTROL when creating GUI objects, the normal default parent will be the current modal dialog (if there is one), else the main window.  to apply to subsequent TPRINT/DPRINT and Tab(-1,9) and Tab(-1,10) commands.  

Although you can accomplish the same result using the AUI_CONTROL functions and specifying the parent control explicitly, the MX_AUTOPARENT function greatly simplifies dialog coding by allowing you to use the much simpler TPRINT, DPRINT, and Tab(-1,9-10) commands. This is particularly true if SET AUTOTPRINT is used to interpret existing PRINT statements as if they were TPRINT statements.

Note that MX_AUTOPARENT will be automatically forwarded to the ATE client via AG_AUTOPARENT.

Parameters

newctrlid  (String/Num)  [in]

The alphanumeric control name or numeric ID of the new auto parent.  Must be set to "" if you just want to query the existing auto parent without changing it.

oldctrlid (Num)  [out]

If specified, returns the numeric ID of the previous auto parent control.

See Also

A-Shell (pflag option related to autoparent)

History

2014 February, A-Shell 6.1.1374:  Add support for current and new auto parent.