Introduction to CMac: 12.1 DIALOG BOXES: The Elements
First you should read chapters 6 & 7 on Dialog Boxes in the CMAC User Guide. Details mentioned there are not mentioned here.
The following elements are available for Multi-Edit dialog boxes. (They're called “controls” or “control types” in the documentation. I'm calling them “elements” here):
STATIC TEXT (dlg_Static)
TEXT (dlg_Text)
INTEGER (dlg_Integer)
CHOICE (dlg_Choice)
CHECKBOX (dlg_CheckBox)
AUTO 3 STATE CHECKBOX (dlg_3State)
When chosen, the box automatically advances between three states: checked, unchecked, and grayed out.
RADIO BUTTON (dlg_RadioButton)
(Radio buttons are only useful if you have more than one to choose from.)
PUSH BUTTON (dlg_PushButton)
BITMAP BUTTON (dlg_BitmapBtn)
BITMAP BUTTON with text (dlg_BitmapBtn)
All available bitmap images are listed in the http://www.multieditsoftware.com/CMacGuide-info.phpCMAC User Guide Chapter 7. This one is bitmap BT_ED_110. You can also see many of the available bitmaps via MACRO → RUN → “Set_Bitmap”.
DIRECTORY BUTTON (dlg_DirButton)
The image here is actually two elements. There's a dlg_Text element where you can type in a filename (or Directory), then there's a dlg_DirButton
which you can click to get a standard “Select File” (or “Select Directory”) dialog.
KEYCODE (dlgKeycode)
Used for entering a key or key combination (such as Ctrl+Z). User clicks the
button to get a second dialog prompting them to press a key.
SELECT COLOR (dlg_SelectColor)
When you click on the COLOR button it brings up a standard color selection dialog.
MACRO BUTTON WHICH RETURNS A STRING (dlg_MacroBtnStr)
This one's a bit complicated. When you click the
button it runs the macro you specified. The macro may return a string in system variable Return_Str. If the macro sets Return_Int=TRUE then the string returned in Return_Str is displayed in the text field. You can not manually edit the text field.
The one example of this is TOOLS → CUSTOMIZE → General (left side), “Command set:”. You can click the
button to get the “Command Set Manager” dialog box. The “Command Set Manager” dialog box does all the work, and changes the keymap if you select another one. The “Command Set Manager” dialog box returns in system variable Return_Str a string indicating which keymap you chose to change to.
STATIC ICONS & BITMAPS
These are the three icons I've been able to find in Mult-Edit.
- question mark
- exclamation point
- stop sign
STATIC BITMAP (dlg_BitmapStatic)
All available bitmap images are listed in the CMAC User Guide Chapter 7. This one is bitmap BT_ED_110.
BOXES, RECTANGLES, FRAMES
GROUP BOX (dlg_GroupBox)
A group box has text such as the word “Options” here.
The following two look similar:
GREY FRAME (dlg_GreyFrame)
GREY RECTANGLE (dlg_GreyRect)
The following four look similar:
BLACK FRAME (dlg_BlackFrame)
BLACK RECTANGLE (dlg_BlackRect)
WHITE FRAME (dlg_WhiteFrame)
WHITE RECTANGLE (dlg_WhiteRect)
EXAMPLE:
Put them all together and you can make a dialog box such as this:
MORE DIALOG BOX CONTROLS
ListBox
The dlg_ListBox control is quite versatile. Use it when you want to display a list of items. Here is a simple example from Introduction to CMAC. 7: Multi-Edit Tags.
More examples of a ListBox:
TOOLS → ASCII TABLE (lists all the ASCII codes)
TOOLS → CALCULATOR (scrolling tape display)
“List All Macros”. MACRO → RUN, enter “ListMacs”
“List All Globals”. MACRO → RUN, enter “ListGlob”
“List Tags”. MACRO → RUN, enter “Tag_List” (two ListBox windows on top and a dlg_ViewTextBox on the bottom.)
TOOLS → CUSTOMIZE → General (left side) → COLORS (the list of colors for each kind of line.)
TOOLS → CUSTOMIZE → Import/Export (left side). A ListBox in the middle and a dlg_TreeList on the right.
TreeList
ViewTextBox
TabBar and TreeBar
dlg_TabBar
A more advanced dialog box can use tabs. The tab you select determines what you see. The “Search” dialog has six tabs:
(dlg_TabBar)
dlg_TreeBar
A similar concept is the tree bar. One example of this is the TOOLS → CUSTOMIZE dialog. The option you select on the left determines what you see on the right.
(dlg_TreeBar)
(dlg_SubDlg is used with TabBars and TreeBars)
The following dialog elements are not used by Multi-Edit. I've had no success getting them to work. However there are alternatives for each one.
dlg_RealNumber
Real number prompt. Dialog works but there's no way to retrieve the number. Instead use dlg_Text to get a string, then use Rval to convert string to a real number.
dlg_Hex
Hex number prompt. No success getting this one to work. Instead use dlg_Text to get a hex string, then convert hex string to integer using a routine similar to this:
int hex_to_int(str hexstr)
{
// Converts hexstr to an integer
// Example: hexstr = "F3C2", n will = 62402
// hexstr numbers greater than "7FFFFFFF"
// will convert to a negative number
int i,j;
int n = 0;
hexstr = Lower(Remove_Space(hexstr));
j = length(hexstr);
if (j > 8) {/*error*/ Return(0);}
for (i = 1; i <= j; i++){
n = (n * 16) +
(XPOS( copy(hexstr,i,1), "0123456789abcdef", 1) - 1);
}
Return(n);
}
dlg_ListTextBox
I think this one is obsolete. Use dlg_ListBox instead for a more versatile control.
dlg_MacroBtnInt
Use dlg_MacroBtnStr, using a string version of the integer.
dlg_HiddenStr
Hidden text prompt - for passwords, etc. Instead use dlg_Text with dlgf_es_Password flag.
dlg_HiddenInt
Hidden integer prompt - for passwords, PINs, etc. Instead use dlg_Text with dlgf_es_Password flag. Then convert string to integer using Val.
Will discuss later (maybe):
dlg_OwnerButton Used twice in COLORS.S
dlg_BitmapDefine























