Command Prompt for Windows




Dialog Box Editor

The WinOne® Command Prompt includes a Dialog Box editor (ie. DLGEDIT.EXE) to help with the creation and design of Dialog Boxes that can be used inside a Batch File. When the Dialog Box Editor is first run, it creates a menu bar along the top of your desktop, as follows :-

Use the various menu options to create and manipulate dialog boxes items, including the dialog box itself. The inital Dialog Box, that is created can be moved and resized as desired.

When all the items have been placed on a Dialog Box and it is complete, simply use the Copy option in the Edit menu to copy the batch commands to the clipboard, and then paste them into your batch file.

For example :-

Will copy the following commands to the clipboard :-

DLGBOX "Example Dialog" 100 33 41 207 72

DLGITEM "&OK" BUTTON 101 100 80 43 50 14
DLGITEM "" LEDIT 102 100 74 17 114 13
DLGITEM "Enter your name:" LTEXT 103 100 17 19 58 9
DLGITEM "&Cancel" BUTTON 104 100 138 43 50 14

All that is left to do is to hook up the dialog items to procedures and show the dialog box :-

@ECHO off
REM
REM Simple example of a dialog box
REM
DLGBOX "Example Dialog" 100 33 41 207 72

DLGITEM "&OK" BUTTON 101 100 80 43 50 14 but_ok
DLGITEM "" LEDIT 102 100 74 17 114 13
DLGITEM "Enter your name:" LTEXT 103 100 17 19 58 9
DLGITEM "Cancel" BUTTON 104 100 138 43 50 14 but_cancel

PROC but_ok
    GETTEXT 100 102
    ECHO You entered: %GETTEXT%
    DLGEND 100 1
ENDPROC

PROC but_cancel
    DLGEND 100 0
ENDPROC

DLGSHOW 100 0
IF (%DLGSHOW% == 1) {
    ECHO OK button pressed
} ELSE {
    ECHO Cancel button pressed
}