Home Page
        Orders     Downloads     Support     Contact     Deutsch
ZOC Terminal is a professional SSH Client and Terminal Emulator for Windows and macOS.
ZOC Online Help Topic:

APPENDIX → ZOC-REXX ZocDialog Templates

A template for the ZocDialog command is a text file which lists and defines the elements that appear within dialog window.

The generalized syntax of a dialog template entry is
<type> <itemid> = "<text>", <val1>, <val2>[, <val3>[, <>val4>]]
e.g.
DIALOG IDDLG0 = "Enter Username", 260,260

The type of the entry is defined by the first word according to the list below (uppercase required). The itemid is a user defined string that can be used to retrieve the item's value after the user closes the dialog (e.g. to check the user's input in a text field). The text depends on the type of item and it is usually either its title or content. Depending on the type of item, val1/val2 are either its x/y location within the window or its size. The values val3/val4 define size (width/height) for those items which have val1/val2 giving a location. Width and height values can sometimes be omitted and to create the item with standard width and height.

The interpreter for these commands is rather basic and unforgiving, so please do not make assumptions about other ways to write the templates beyond the syntax and samples given here and in general do not take syntactical liberties. Strictly one dialog element per line. Lines which start either with // or -- or # are treated as a comment. Empty lines are allowed within the file.

 

List of possible dialog-template entries:

       
DIALOG
 

DIALOG <itemid> = "<title>", <width>, <height>
Defines the window title and size of the dialog.

STATICTEXT
 

STATICTEXT <itemid> = "<text>", <x-pos>, <y-pos>[, <width>[, <height>]]
Creates a piece of descriptive text (e.g. a label).

EDITTEXT
 

EDITTEXT <itemid> = "<contents>", <x-pos>, <y-pos>[, <width>[, <height>]]
Creates a field for text entry, preset with the given contents. The itemid can later be used to retrieve the user entry after the dialog was processed.

EDITPASSWORD
 

Same as EDITTEXT, but with hidden input.

CHECKBOX
 

CHECKBOX <itemid> = "<title>", <x-pos>, <y-pos>[, <width>[, <height>]]
Creates a checkbox control with the given title in the given location. The itemid can be used to retrieve the state of the checkbox when the dialog was processed. If the text starts with [*], the checkbox will be initially active (checked).

RADIOBUTTON
 

RADIOBUTTON <itemid> = "<title>", <x-pos>, <y-pos>[, <width>[, <height>]]
Creates a radiobutton control with the given title in the given location. The itemid can be used to retrieve the state of the radiobutton when the dialog was processed. If the text starts with [*], the radiobutton will be initially activated.

GROUPBOX
 

GROUPBOX <itemid> = "<title>", <x-pos>, <y-pos>, <width>, <height>
Creates a rectangular box within the window to group or separate content. There is a limit of max five groupboxes per dialog.

DROPDOWNLIST
 

DROPDOWNLIST <itemid> = "<content>", <x-pos>, <y-pos>, <width>, <height>
Creates a multiple-choice field with a list of values where the list of values can be dropped down to select one. The values of the items are provided in the content parameter separated by a vertical bar (e.g. "Yes|No|Maybe"). If an item starts with [*], this item will be preselected. The itemid can be used to retrieve name of the selected choice when the dialog was processed. There is a limit of max five dropdownlist items per dialog.

LISTBOX
 

LISTBOX <itemid> = "<content>", <x-pos>, <y-pos>, <width>, <height>
Creates a list of items where one can be selected. The items are displayed in a vertical list with a possible scrollbar if the listbox is too small to display them all. The values of the items are provided in the content parameter separated by a vertical bar (e.g. "Yes|No|Maybe"). If an item starts with [*], this item will be preselected. The itemid can be used to retrieve name of the selected choice when the dialog was processed.

PUSHBUTTON
 

PUSHBUTTON <itemid> = "<text>", <x-pos>, <y-pos>[, <width>[, <height>]]
Creates a pushbutton, i.e. a button that will close the dialog when pressed. The button which was used to close the dialog, will return a value "1" when queried with the ZocDialog GET command and the itemid.

DEFPUSHBUTTON
 

Same as PUSHBUTTON but will create a button that is highlighted as the default button (DEFPUSHBUTTON is usually the OK the okay- or finish-button).

 

 

Example: test.dlg
 

// Below is the first dialog template within the test.dlg template file
DIALOG MSG1 = "Simple Sample Dialog", 260,140
STATICTEXT ST = "Congratulations! This is your first dialog.", 12,12, 100,60
DEFPUSHBUTTON P1 = "OK", 120,70
    
// This is another dialog template within the same template file
DIALOG MAIN = "Sample Dialog", 260,310
STATICTEXT ST1 = "Your name", 12,12, 100
EDITTEXT ED1 = "Harry", 112,10
CHECKBOX CB1 = "I am a programmer", 14,50, 150
GROUPBOX G1 = "Your favorite color?", 12, 90, 200,90
DROPDOWNLIST DD1= "Red|[*]Green|Blue", 20,115, 170,100
RADIOBUTTON RB1 = "VT220", 14,190, 80
RADIOBUTTON RB2 = "[*]Xterm", 100,190, 80
DEFPUSHBUTTON P1 = "OK", 12, 230, 80
PUSHBUTTON P2 = "Cancel", 112, 230, 80

Example: Script that uses the above template
 

-- show simple message
CALL ZocDialog "SHOW", "MSG1@test.dlg"
    
-- show complex dialog and check input
dlgrc= ZocDialog("SHOW", "MAIN@test.dlg")
SAY ">"dlgrc
IF dlgrc=="##OK##" THEN DO
  okpressed= ZocDialog("GET", "P1")
  IF okpressed==1 THEN DO
    SAY "EDITTEXT value: "||ZocDialog("GET", "ED1")
    SAY "CHECKBOX value: "||ZocDialog("GET", "CB1")
    SAY "DROPDOWNLIST value: "||ZocDialog("GET", "DD1")
  END
END

 
← Back to APPENDIX

 

Downloads
Orders
Contact
Support
Terms of Use
Privacy Policy
pixel