MIAMEX 141: Set Parent Control

Updated February 2014; see History

See History.

xcall MIAMEX, MX_AUTOPARENT, ctrlid

MX_AUTOPARENT allows you to set the default parent control, 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.

MX_AUTOPARENT can be used to set the parent to a group box (rather than a dialog), but in this case, only the TPRINT and DPRINT commands are affected.

You should clear the auto parent setting when no longer needed, by calling the routine with ctrlid set to 0. It will also be cleared automatically at the start of a new RUN program.

See the TAB(-10,x) Function Listing for an equivalent Print Tab command (AG_AUTOPARENT).

History

2014 February, A-Shell 6.1.1375:  MX_AUTOPARENT TAB(-1,0) now confined to deleting just the children of the auto-parent dialog. Note that the auto-parent dialog setting is normally cleared at the start of each new program, so this change will typically not affect XY=0 but is designed mainly to make it easier to execute existing RUN programs within a dialog. See new AMOS.SBR +8 flag added in 1374.0 for a related feature.

2014 February, A-Shell 6.1.1374:  Add support for current and new auto parent. See two Update Notes below.

Update Note: 6.1.1374 Update A

MX_AUTOPARENT now supports an option to return the current auto parent. New syntax:

xcall MX_AUTOPARENT, newctlid {,oldctlid}

To retrieve the current setting without changing it, specify a literal null string for newctlid, e.g.

xcall MX_AUTOPARENT, "", oldctlid

In the ATE environment, the feature requires that both the server and client be at least at edit 1374. Otherwise, the oldctlid will be returned as -99.

 

Update Note: 6.1.1374 Update B

AG_AUTOPARENT now returns the current auto parent, in numeric form, as well as the new one.

? tab(-10,AG_AUTOPARENT);newctlid$,1;chr(127);

input "",newctlid,oldctlid

 

Note that the newctlid$ specified by the application may be alphanumeric, while both the returned newctlid and oldctlid will be numeric.

Older ATE clients will only return the newctlid value, thus if you are depending on it, you should either verify the ATE edit level, or use the MX_AUTOPARENT version, which will return -99 if either the server or client doesn't support it.

Older programs unaware of the new feature shouldn't be affected, since the return value has always been numeric. The value of "n1,n2" is the same as the value of "n1".