CRT Icon  Dialog Object


 

Description

The Dialog object provides access to simple user-interface features provided by CRT.

 

Syntax

dialog.Method([arglist])

 

Remarks

CRT's Dialog object is accessed through the top-level objectÆs æDialogÆ property.

 

Dialog Object Methods

 

Methods

 

ááááPrompt

 

ááááMessageBox

 

Methods

 

Prompt

Description

Prompt a user to enter a string.

Syntax

object.Prompt(message [, title [, default [, isPassword ]]])

Remarks

The Prompt function displays a simple dialog that has message and an edit field for the user to enter a string. The message parameter is simply an informational string displayed in the prompt dialog. Optionally the title of the prompt dialog may be set by passing a title string. By default the edit field is empty, but the initial contents of the edit field may be set with the optional default string. Finally, if the text entered in the edit field is to be obscured as it is entered (such as when entering a password) then the boolean æisPasswordÆ field should be set to True.

If the user clicks OK, Prompt returns the entered string.

 

Example:

Dim pass

pass = crt.Dialog.Prompt("Enter your password:", "Login Script", "", True)

 

MessageBox

Description

Display a message

Syntax

object.MessageBox(message [, title [, default [, buttons]]])

Remarks

The MessageBox function displays a message string to the user. The optional title string sets the title or caption of the MessageBox. The buttons that appear on the MessageBox can be configured by passing a combination of numeric values in the optional æbuttonsÆ parameter. By default MessageBox will display the message string with an "OK" button. However, many possibilities exist for displaying messageboxes with different icons, and buttons.

The MessageBox function returns a numeric value that can be used to identify which button was clicked.

 

The following code sample defines the constants that can be combined to form the æbuttonÆ parameter as well as the possible numeric return values:

 

' button parameter options

Const ICON_STOP = 16ááááááááááááááááá' display the ERROR/STOP icon.

Const ICON_QUESTION = 32ááááááááááááá' display the '?' icon

Const ICON_WARN = 48ááááááááááááááááá' display a '!' icon.

Const ICON_INFO= 64áááááááááááááááááá' displays "info" icon.

 

Const BUTTON_OK = 0áááááááááááááááááá' OK button only

Const BUTTON_CANCEL = 1áááááááááááááá' OK and Cancel buttons

Const BUTTON_ABORTRETRYIGNORE = 2áááá' Abort, Retry, and Ignore buttons

Const BUTTON_YESNOCANCEL = 3ááááááááá' Yes, No, and Cancel buttons

Const BUTTON_YESNO = 4ááááááááááááááá' Yes and No buttons

Const BUTTON_RETRYCANCEL = 5ááááááááá' Retry and Cancel buttons

 

Const DEFBUTTON1 = 0áááááááá' First button is default

Const DEFBUTTON2 = 256áááááá' Second button is default

Const DEFBUTTON3 = 512áááááá' Third button is default

 

' Possible MessageBox() return values

Const IDOK = 1áááááááááááááá' OK button clicked

Const IDCANCEL = 2áááááááááá' Cancel button clicked

Const IDABORT = 3ááááááááááá' Abort button clicked

Const IDRETRY = 4ááááááááááá' Retry button clicked

Const IDIGNORE = 5áááááááááá' Ignore button clicked

Const IDYES = 6ááááááááááááá' Yes button clicked

Const IDNO = 7áááááááááááááá' No button clicked

 

' Display a messagebox with Yes/No buttons.

' Make the 'No' button the default.

result = crt.Dialog.MessageBox("Login Failed, Retry?", "Error", ICON_QUESTION Or BUTTON_YESNO Or DEFBUTTON2 )

If result = IDNO Then

     Exit Sub

End If