OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Loop<br />
' Close file<br />
Close #FileNo<br />
Msgbox Msg<br />
Files and Directories<br />
The individual lines are retrieved in a Do While loop, saved in the Msg variable, and displayed at the end in a<br />
message box.<br />
Message and Input Boxes<br />
<strong>OpenOffice</strong>.<strong>org</strong> Basic provides the MsgBox and InputBox functions for basic user communication.<br />
Displaying Messages<br />
MsgBox displays a basic information box, which can have one or more buttons. In its simplest variant the MsgBox<br />
only contains text and an OK button:<br />
MsgBox "This is a piece of information!"<br />
The appearance of the information box can be changed using a parameter. The parameter provides the option of<br />
adding additional buttons, defining the pre-assigned button, and adding an information symbol.<br />
Note – By convention, the symbolic names given below are written in UPPERCASE, to mark them as<br />
predefined, rather than user-defined. However, the names are not case-sensitive.<br />
The values for selecting the buttons are:<br />
0, MB_OK - OK button<br />
1, MB_OKCANCEL - OK and Cancel button<br />
2, MB_ABORTRETRYIGNORE - Abort, Retry, and Ignore buttons<br />
3, MB_YESNOCANCEL - Yes, No, and Cancel buttons<br />
4, MB_YESNO - Yes and No buttons<br />
5, MB_RETRYCANCEL - Retry and Cancel buttons<br />
To set a button as the default button, add one of the following values to the parameter value from the list of<br />
button selections. For example, to create Yes, No and Cancel buttons (value 3) where Cancel is the default (value<br />
512), the parameter value is 3 + 512 = 515. The expression MB_YESNOCANCEL + MB_DEFBUTTON3 is harder to<br />
write, but easier to understand.<br />
0, MB_DEFBUTTON1 - First button is default value<br />
256, MB_DEFBUTTON2 - Second button is default value<br />
512, MB_DEFBUTTON3 - Third button is default value<br />
Finally, the following information symbols are available and can also be displayed by adding the relevant<br />
parameter values:<br />
16, MB_ICONSTOP - Stop sign<br />
32, MB_ICONQUESTION - Question mark<br />
48, MB_ICONEXCLAMATION - Exclamation point<br />
64, MB_ICONINFORMATION - Tip icon<br />
The following call displays an information box with the Yes and No buttons (value 4), of which the second<br />
button (No) is set as the default value (value 256) and which also receives a question mark (value 32),<br />
4+256+32=292.<br />
MsgBox "Do you want to continue?", 292<br />
' or,<br />
MsgBox "Do you want to continue?", MB_YESNO + MB_DEFBUTTON2 + MB_ICONQUESTION<br />
Chapter 3 · Runtime Library 47