Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

5.14 Message Boxes

5.14.1 Overview

Message boxes provide a convenient and conventional manner to display messages regarding errors or user interactions either via Windows or a console. Legato provides a standard window message box that consists of four components:

The Caption is defined by the application name (which can be changed). The caption will also contain a close button ([X]), which is processed the same as a “Cancel” button.

The Icon is defined by the message box’s type. If the type is omitted, the icon area will be empty. The type icon also sets a possible sound to be played as defined by the operating system.

The Message Area contains string data to be conveyed to the user. The area is not static. It can be selected and copied, and it also can overflow the fixed area (without scrollbars).

Finally, the Buttons area contains buttons that are determined by the function which created the message box. For example, the MessageBox function provides only an “OK” button while the OkCancelBox function has “OK” and “Cancel” buttons.

Message box functions should only be used in a primary thread. 

5.14.2 Message Box Function Syntax/Parameters

All message box functions follow the same parameter syntax.

Syntax

int = function ( [int type], string format, [parameters ...] ); 

Parameters

type

An optional int containing an icon type. This parameter can also contain a char value that resolves to an integer. The permissible values are:

  Code   As Define   Description   Window
Icon
  'I'   MB_INFO   Information — This should be used to display information regarding a process or activity that ended or processed normally but warrants user notification.  
  'N'   MB_NONE    No Icon — No special meaning (no icon).   (none)
  'Q'   MB_QUESTION   Question — Obvious question. Should have buttons as OK/Cancel or Yes/No.  
  'S'   MB_STOP   Stop — A serious error occurred resulting in the activity being stopped. This should generally only be used when something serious has happened (for example, a file write error or some internal error). When used, this setting causes the system to play the ‘Critical Stop’ sound.  
  'X'   MB_EXCLAMATION   Exclamation — An error that is usually the result of a user error or condition (for example, a required field in a dialog was not filled out or contained a syntax error). When used, this setting causes the system to play the ‘Exclamation’ sound.  

 

The parameter selection does not change the buttons presented and type is not case-sensitive.

message

A string to display. If additional parameters are present, message is considered a formatted string. See Section 5.2 String Functions for more information on formatted strings.

parameters

Zero or more parameters to be formatted and inserted into message. If no parameters are supplied, message is simply passed through to the result string.

Return Value

Returns an int as one of the Windows standard button IDs. All message boxes will return IDCANCEL (2) on pressing the Escape key or the close [X] button. The following are the possible return codes:

  1 IDOK OK button.  
  2 IDCANCEL Cancel button.  
  3 IDABORT Abort button (not presently used by message box functions).  
  4 IDRETRY Retry button (not presently used by message box functions).  
  5 IDIGNORE Ignore button (not presently used by message box functions).  
  6 IDYES Yes button.  
  7 IDNO No button.  

 

5.14.3 Console Operation

When message box functions are used in the context of the console version of Legato Basic, output is directed to the console rather than a message box window. Input as also taken from the console.

5.14.4 Message Box Functions

The available message box functions are as follows:

  MessageBox
  OkCancelBox

 

 

YesNoBox
  YesNoCancelBox
     

5.14.5 Other Functions