Reviewed and revised December 2020
xcall MIAMEX, MX_DEFTABXYZ, sts, Z {, fgc, bgc, ptype, fontattr, fontscale, fontface, flags}
xcall MIAMEX, MX_DEFTABXYZ, sts, Z
xcall MIAMEX, MX_DEFTABXYZ, sts, 0, count
MX_DEFTABXYZ allows you to associate a variety of text attributes with the value Z, so that when you use PRINT TAB(X,Y,Z);VAR$, A-Shell will apply the specified attributes to the display of VAR$.
• The first syntax is used for defining a set of attributes to be associated with the index Z.
• The second syntax is used for removing the definition for index Z. See Comments, below, for additional info.
• The third syntax is for expanding the table to allow for count definitions (i.e. for Z = 1 to count). See Comments, below, for additional info.
Typically, you would issue several of these subroutine calls when you first log in to your main menu (one per Z value that you actually use in the application). For example:
! Define style 1: normal text, FGC=2, BGC=0
XCALL MIAMEX,MX_DEFTABXYZ,STS,1,5,0
! Define style 2: GUI text, standard GUI colors, TPRINT style
XCALL MIAMEX,MX_DEFTABXYZ,STS,2,-2,-2,"TL"
! Define style 3: GUI text (Blue=66) in a sunken panel, extra bold
XCALL MIAMEX,MX_DEFTABXYZ,STS,3,66,-2,"DL",14400
etc.
sts (F,6)
returns >=0 if success, else error. -1 means that the table could not be allocated (out of memory?) and -2 means that the specified Z value is larger than the current maximum table size.
Z (Integer, 1-19)
the Z value in TAB(X,Y,Z).
fgc, bgc (Integer)
foreground/background color palette values. As with the like-named parameters in AUI_CONTROL, -1 indicates the current color, -2 indicates the standard Windows color. Add +64 to override the Windows Theme color. You may also specify RGB values.
ptype (String)
indicating a combination of style and justification. If null, then only the fgc, bgc values matter and the output will use the normal text (fixed pitch) style of the emulator. Otherwise, the format of the string is: "SJ" where S is replaced by: "T" (TPRINT), "D" (DPRINT ), or "E" (EPRINT) and J is the justification code ("L"=left/auto, "C"=center, "R"=right). The TPRINT style is the normal GUI text style. DPRINT style is like that but within a sunken panel (normally used for data as opposed to labels or background text). EPRINT style is the white edit box normally used for INFLD or windows editable text. The left justification code also auto-justifies if the first character of the field is blank. In that case, if the last character is also blank, then the field is centered, else it is right justified. (This has to be done automatically because you cannot manually figure out how big the display font will be in order to justify, so A-Shell does it on the fly.) Note that right justify actually leaves one trailing blank, since otherwise it looks too "cramped" when using the DPRINT or EPRINT styles.
Valid ptype codes include the following:
Value |
Meaning |
T[ |
like TL but shrinks control to just fit the text |
T] |
like T[ but right justified |
D[ |
like DL but shrinks control to just fit the text |
D] |
like DR but right justified |
fontattr, fontscale, fontface
font attributes, scale factor, and font name, as in the AUI_CONTROL call.
flags (Num) [in]
may specify zero or more of the following options:
Flag |
Value |
Description |
TBZF_AUTONUMKBD |
&h0001 |
TBZF_AUTONUMKBD will automatically assign a click string equal to the numeric value at the start of the string. Requires that the ptype be one of the non-null options (starting with "T", "D", or "E"). |
TBZF_AUTOCR |
&h0002 |
TBZF_AUTOCR may be combined with TBZF_AUTONUMKBD to append a chr(13) to the numeric click string. |
TBZF_AUTOFKY100 |
&h0004 |
TBZF_AUTOFKY100 is similar to TBZF_AUTONUMKBD except that instead of sending the numeric digits as the click string, it sends the virtual key code sequence VK_xF# where # is the string of numeric digits. In other words, a label containing "13. Go Directly To Jail" acts like the function key F13 when clicked. |
TBZF_HIDENUM |
&h0008 |
TBZF_HIDENUM may be added to any of the above to strip off the leading number before displaying the text. For example, when printed, the string "13. Go Directly To Jail", would appear as "Go Directly To Jail", i.e. without the "13." The idea here is that numbered fields are a vestige of traditional text-based applications which had no other way for the user to direct the focus. |
TBZF_LINKTOLBL |
&h0010 |
Causes the control (created via Tab(x,y,z)) to be assigned the same click string as the control (presumably the label) immediately to the left of the newly created control. As an example, if you used Z=1 for labels (with the TBZF_AUTOFKY100 bit set), and Z=2 for data fields (with the TBZF_LINKTOLBL bit set), the following would result in both labels and data fields sending EXITCODE -1## (## matches the label numeric prefix) on click:
? tab(4,10,1);"1. Name"; ? tab(5,10,1)'"2. Address:"; ... ? tab(4,40,2);NAME$ ? tab(5,10,1);ADDR$ ... |
Definition file: ashell.def |
Comments
If the default maximum 19 text types is not sufficient, you can pre-allocate a larger table using:
xcall MIAMEX,MX_DEFTABXYZ, sts, 0, count
Where count is the desired number of text type definitions. sts will be returned with the new maximum (which may be larger than the amount requested.) Allocating a larger table will delete the current table.
Once the MX_DEFTABXYZ call is used to define a set of attributes for a particular Z value, it remains in effect until you exit A-Shell or undefine it. To undefine a value, just use the form:
xcall MIAMEX, MX_DEFTABXYZ, sts, z
At runtime, referencing a Z value that is undefined will cause the TAB(X,Y,Z) to just act like a normal TAB(X,Y). This is also true if GUI not supported by the emulator.
See Also
History
2012 June, A-Shell 6.0.1251: Added flags argument