IB Statements/msgboxfunc

From CometWiki

< IB Statements(Difference between revisions)
Jump to: navigation, search
(New page: '''LEN function''' '''Syntax:''' LEN(string-argument) '''Discussion:''' The LEN function returns the current number of characters that are currently stored in the string-argument, r...)
(initial edit)
 
Line 1: Line 1:
-
'''LEN function'''
+
==MSGBOX Function==
-
'''Syntax:'''  LEN(string-argument)
+
{|
-
+
|-
-
'''Discussion:''' The LEN function returns the current number of characters that are currently stored in the string-argument, regardless of the defined length of the string-argument. The value returned by the LEN function is called the "current length" of the string-argument.
+
|'''Discussion:'''
-
+
|
-
The current length may be different than the defined length depending on how the field was filled. If the field was filled from the keyboard, and if blanks were stripped from the field at input time, the current length will be less than or equal to the defined length. But, if the field was filled from a data file (where there is no blank stripping), the current length will equal the defined length.  
+
The MSGBOX function displays a Windows-style message box containing a specified string
 +
and one or more buttons (i.e., OK, Cancel, Abort, Retry, Ignore, Yes, No, Close, Help).
 +
The program is halted until the user clicks on one of the buttons. The value of the
 +
clicked button is returned to the program.
 +
|-
 +
|'''Syntax:'''
 +
|Result = MSGBOX(string-expression, caption, type)
 +
|-
 +
|'''Where:'''
 +
|'''Result''' is a numeric value representing which button was clicked, based on the following table:
 +
|-
 +
|'''Example:'''
 +
|
 +
TYPE = MB.ABORTTETRYIGNORE + MB.ICONQUESTION
 +
Result = MSGBOX(“Click Abort, Retry, or Ignore”,”Sample program”,TYPE)
 +
|-
 +
|'''Result:'''
 +
|
 +
<pre>
 +
!==========================================================
 +
! These are standard ID's assigned by WINDOWS and used
 +
! in many dialogs that have an OK and CANCEL button etc.
 +
!==========================================================
 +
if result = 1 print 'That means ID.OK'
 +
if result = 1 print 'That means IDOK'
 +
if result = 2 print 'That means ID.CANCEL'
 +
if result = 2 print 'That means IDCANCEL'
 +
if result = 3 print 'That means ID.ABORT'
 +
if result = 3 print 'That means IDABORT '
 +
if result = 4 print 'That means ID.RETRY'
 +
if result = 4 print 'That means IDRETRY'
 +
if result = 5 print 'That means ID.IGNORE'
 +
if result = 5 print 'That means IDIGNORE'
 +
if result = 6 print 'That means ID.YES'
 +
if result = 6 print 'That means IDYES'
 +
if result = 7 print 'That means ID.NO'
 +
if result = 7 print 'That means IDNO'
 +
if result = 8 print 'That means ID.CLOSE'
 +
if result = 8 print 'That means IDCLOSE'
 +
if result = 9 print 'That means ID.HELP'
 +
if result = 9 print 'That means IDHELP'
 +
</pre>
 +
|}
 +
'''String-expression''' is the text that will appear in the message box above the button(s).
-
The string-argument may be a string constant, a single-element string variable, a string array element, a string expression, or a string function.  
+
'''Caption''' is a string value that will be displayed as the caption for the Window.
-
 
+
{|
-
'''Note:''' If the string-argument is a string variable, the length of the resultant value may be less than or equal to (but never greater than) the defined length of the string variable.  
+
|-
-
 
+
|'''Type''' is a numeric value that represents the type of message box to be displayed,
-
The intermediate result of the LEN function is stored in a numeric accumulator with a precision of 16.0. If this intermediate result is then moved to a receiving numeric variable, its precision is automatically adjusted to the defined precision of that variable.  
+
including which buttons are displayed and the icon that is displayed (i.e., stop sign,
-
 
+
question mark, exclamation mark, information icon). In the following table these value
-
Also see LENGTH.  
+
are expressed using symbolic constants:
-
   
+
|
-
Example:  
+
<pre>
-
 
+
!==========================================================
-
LENGTH 30 & LOCAL A$
+
!
-
.
+
! Type values for the MessageBox function
-
N = LEN(A$)
+
!
-
 
+
!==========================================================
-
In the above example, the current length of the string variable A$ is moved to the numeric variable N. A$ is defined with a length of 30 characters, but assume that its current value is "Signature" followed by 21 nulls. In this case N will equal 9.
+
SET MB.OK = 0 ! 0x00000000L
 +
SET MB.OKCANCEL = 1 ! 0x00000001L
 +
SET MB.ABORTRETRYIGNORE = 2 ! 0x00000002L
 +
SET MB.YESNOCANCEL = 3 ! 0x00000003L
 +
SET MB.YESNO = 4 ! 0x00000004L
 +
SET MB.RETRYCANCEL = 5 ! 0x00000005L
 +
SET MB.ICONHAND = 16 ! MB.ICONSTOP
 +
SET MB.ICONQUESTION = 32 ! 0x00000020L
 +
SET MB.ICONEXCLAMATION = 48 ! 0x00000030L
 +
SET MB.ICONASTERISK = 64 ! MB.ICONINFORMATION
 +
SET MB.USERICON = 128 ! 0x00000080L
 +
SET MB.ICONWARNING = 48 ! MB.ICONEXCLAMATION
 +
SET MB.ICONERROR = 16 ! MB.ICONHAND
 +
SET MB.ICONINFORMATION = 64 ! MB.ICONASTERISK
 +
SET MB.ICONSTOP = 16 ! MB.ICONHAND
 +
SET MB.DEFBUTTON1 = 0 ! 0x00000000L
 +
SET MB.DEFBUTTON2 = 256 ! 0x00000100L
 +
SET MB.DEFBUTTON3 = 512 ! 0x00000200L
 +
SET MB.DEFBUTTON4 = 768 ! 0x00000300L
 +
SET MB.APPLMODAL = 0 ! 0x00000000L
 +
  SET MB.SYSTEMMODAL = 4096 ! 0x00001000L
 +
  SET MB.TASKMODAL = 8192 ! 0x00002000L
 +
SET MB.HELP = 16384 ! 0x00004000L
 +
SET MB.NOFOCUS = 32768 ! 0x00008000L
 +
SET MB.SETFOREGROUND = 65536 ! 0x00010000L
 +
SET MB.DEFAULT.DESKTOP.ONLY = 131072 ! 0x00020000L
 +
SET MB.TOPMOST = 262144 ! 0x00040000L
 +
SET MB.RIGHT = 524288 ! 0x00080000L
 +
SET MB.RTLREADING = 1048576 ! 0x00100000L
 +
SET MB.TYPEMASK = 15 ! 0x0000000FL
 +
SET MB.ICONMASK = 240 ! 0x000000F0L
 +
SET MB.DEFMASK = 3840 ! 0x00000F00L
 +
SET MB.MODEMASK = 12288 ! 0x00003000L
 +
SET MB.MISCMASK = 49152 ! 0x0000C000L
 +
</pre>
 +
|}

Latest revision as of 19:52, 24 September 2010

MSGBOX Function

Discussion:

The MSGBOX function displays a Windows-style message box containing a specified string and one or more buttons (i.e., OK, Cancel, Abort, Retry, Ignore, Yes, No, Close, Help). The program is halted until the user clicks on one of the buttons. The value of the clicked button is returned to the program.

Syntax: Result = MSGBOX(string-expression, caption, type)
Where: Result is a numeric value representing which button was clicked, based on the following table:
Example:
TYPE = MB.ABORTTETRYIGNORE + MB.ICONQUESTION
Result = MSGBOX(“Click Abort, Retry, or Ignore”,”Sample program”,TYPE)
Result:
 !==========================================================
 ! These are standard ID's assigned by WINDOWS and used
 ! in many dialogs that have an OK and CANCEL button etc.
 !==========================================================
 if result = 1 print 'That means ID.OK'
 if result = 1 print 'That means IDOK'
 if result = 2 print 'That means ID.CANCEL'
 if result = 2 print 'That means IDCANCEL'
 if result = 3 print 'That means ID.ABORT'
 if result = 3 print 'That means IDABORT '
 if result = 4 print 'That means ID.RETRY'
 if result = 4 print 'That means IDRETRY'
 if result = 5 print 'That means ID.IGNORE'
 if result = 5 print 'That means IDIGNORE'
 if result = 6 print 'That means ID.YES'
 if result = 6 print 'That means IDYES'
 if result = 7 print 'That means ID.NO'
 if result = 7 print 'That means IDNO'
 if result = 8 print 'That means ID.CLOSE'
 if result = 8 print 'That means IDCLOSE'
 if result = 9 print 'That means ID.HELP'
 if result = 9 print 'That means IDHELP'
 

String-expression is the text that will appear in the message box above the button(s).

Caption is a string value that will be displayed as the caption for the Window.

Type is a numeric value that represents the type of message box to be displayed,

including which buttons are displayed and the icon that is displayed (i.e., stop sign, question mark, exclamation mark, information icon). In the following table these value are expressed using symbolic constants:

 
 !==========================================================
 !
 ! Type values for the MessageBox function
 !
 !========================================================== 
 SET MB.OK = 0 ! 0x00000000L
 SET MB.OKCANCEL = 1 ! 0x00000001L
 SET MB.ABORTRETRYIGNORE = 2 ! 0x00000002L
 SET MB.YESNOCANCEL = 3 ! 0x00000003L
 SET MB.YESNO = 4 ! 0x00000004L
 SET MB.RETRYCANCEL = 5 ! 0x00000005L
 SET MB.ICONHAND = 16 ! MB.ICONSTOP
 SET MB.ICONQUESTION = 32 ! 0x00000020L
 SET MB.ICONEXCLAMATION = 48 ! 0x00000030L
 SET MB.ICONASTERISK = 64 ! MB.ICONINFORMATION
 SET MB.USERICON = 128 ! 0x00000080L
 SET MB.ICONWARNING = 48 ! MB.ICONEXCLAMATION 
 SET MB.ICONERROR = 16 ! MB.ICONHAND
 SET MB.ICONINFORMATION = 64 ! MB.ICONASTERISK
 SET MB.ICONSTOP = 16 ! MB.ICONHAND
 SET MB.DEFBUTTON1 = 0 ! 0x00000000L
 SET MB.DEFBUTTON2 = 256 ! 0x00000100L
 SET MB.DEFBUTTON3 = 512 ! 0x00000200L
 SET MB.DEFBUTTON4 = 768 ! 0x00000300L
 SET MB.APPLMODAL = 0 ! 0x00000000L
 SET MB.SYSTEMMODAL = 4096 ! 0x00001000L
 SET MB.TASKMODAL = 8192 ! 0x00002000L
 SET MB.HELP = 16384 ! 0x00004000L
 SET MB.NOFOCUS = 32768 ! 0x00008000L
 SET MB.SETFOREGROUND = 65536 ! 0x00010000L
 SET MB.DEFAULT.DESKTOP.ONLY = 131072 ! 0x00020000L
 SET MB.TOPMOST = 262144 ! 0x00040000L
 SET MB.RIGHT = 524288 ! 0x00080000L
 SET MB.RTLREADING = 1048576 ! 0x00100000L
 SET MB.TYPEMASK = 15 ! 0x0000000FL
 SET MB.ICONMASK = 240 ! 0x000000F0L
 SET MB.DEFMASK = 3840 ! 0x00000F00L
 SET MB.MODEMASK = 12288 ! 0x00003000L
 SET MB.MISCMASK = 49152 ! 0x0000C000L
 
Personal tools