Scripts: Controls

The Controls script contains the classes for Dialogs, and the controls in them. It also contains procedures for message boxes.

Classes

Public Procedures

  • number Print(string aMessage[, printParams])

    Prints text in a message box on the screen. With the printParams, you can have icons, buttons, edits and more in your message box. If buttons are specified, the button ID of the button clicked is returned.

    The prints params can be any/all of the following...

    #mode newMode
    Sets the dialog's DText mode to newMode.

    #font newFont

    Sets the dialog's font to newFont.

    #width theMaxWidth

    Sets with dialog's DText maxWidth to theMaxWidth.

    #time seconds

    Automatically close the dialog after the specified seconds.

    #title aString

    Sets the dialogs title text to aString.

    #at x y

    Sets the dialogs coordinates to x,y.

    #draw

    Draws the cast specified by the global variable gCast.

    #edit text max

    Inserts an edit control in the dialog, settings it's text and max.

    #button text ID

    Adds a button to the dialog. If the button is clicked, Print() will return it's specified ID.
    There can only be maximum six buttons if you use the Print() procedure for your dialog box.

    #icon (pIcon) or (view loop cel)

    If an icon object is specified, it is drawn to the dialog. Otherwise, three parameters are need, and the icon will be drawn with the view, loop and cel specified.

    #dispose

    disposes the object pointed to by the global variable gPrintDlg, then sets gPrintDlg to point to the dialog.

    #window newWindow
    Sets the dialog's window to newWindow.
  • number IconPrint(string aMessage, number view, number loop, number cel[, printParams])

    Identical to Print(), but prints an icon specified by view, loop, cel. It returns the ID of the button clicked if any are specified.

  • number EditPrint(string theText, number theMax[, string aMessage, printParams])

    Produces a dialog box with an edit control. The text entered in it is stored in theText to be accessed after the dialog closes. The theMax property specified the maximum number of characters which can be edited. If specified, aMessage will display a message above the edit control. The printParams property allows you to add extra controls to the dialog.

    It returns the length of the string entered.

  • number GetNumber(string aMessage[, number defaultNumber])

    Produces a dialog box with an edit control to allow the user to enter a number. It displays aMessage above the edit control, and if specified, sets the edit control's text to defaultNumber. It returns the number entered. If no number, or an invalid number is entered, it returns -1.

  • number FormatPrint(string theText[, formatParams])

    Print's a dialog box with the specified text. This allows the user to format the text with control characters such as %s and %d. For more information, see kernel Format().