summaryrefslogtreecommitdiffstats
path: root/helpcontent2/source/text/sbasic/shared/03010101.xhp
blob: 09597684425ba7581799192fb4b16720c6accf3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
<!--
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->

<meta>
  <topic id="textsbasicshared03010101xml" indexer="include" status="PUBLISH">
    <title id="tit" xml-lang="en-US">MsgBox Statement</title>
    <filename>/text/sbasic/shared/03010101.xhp</filename>
  </topic>
</meta>

<body>


<section id="msgbox">
<bookmark xml-lang="en-US" branch="index" id="bm_id1807916">
  <bookmark_value>MsgBox statement</bookmark_value>
</bookmark>


<paragraph id="hd_id3154927" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03010101.xhp">MsgBox Statement</link></paragraph>
<paragraph id="par_id3148947" role="paragraph" xml-lang="en-US">Displays a dialog box containing a message.</paragraph>
</section>

<paragraph id="hd_id3153897" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph>
<bascode>
<paragraph id="par_id3148664" role="bascode" xml-lang="en-US">MsgBox Text As String [,Type As Integer [,Dialogtitle As String]] (As Statement) or MsgBox (Text As String [,Type As Integer [,Dialogtitle As String]]) (As Function)</paragraph>
</bascode>

<paragraph id="hd_id3153361" role="heading" level="2" xml-lang="en-US">Parameter:</paragraph>
<paragraph id="par_id3148798" role="paragraph" xml-lang="en-US"> <emph>Text</emph>: String expression displayed as a message in the dialog box. Line breaks can be inserted with Chr$(13).</paragraph>
<paragraph id="par_id3150769" role="paragraph" xml-lang="en-US"> <emph>DialogTitle</emph>: String expression displayed in the title bar of the dialog. If omitted, the title bar displays the name of the respective application.</paragraph>
<paragraph id="par_id3147228" role="paragraph" xml-lang="en-US"> <emph>Type</emph>: Any integer expression that specifies the dialog type, as well as the number and type of buttons to display, and the icon type. <emph>Type</emph> represents a combination of bit patterns, that is, a combination of elements can be defined by adding their respective values:</paragraph>

<table id="tbl_051220170220345412">
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170241588881" role="tablehead" xml-lang="en-US">Named constant</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170241585541" role="tablehead" xml-lang="en-US">Integer value</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170241585124" role="tablehead" xml-lang="en-US">Definition</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170241588348" role="tablecontent" localize="false" xml-lang="en-US">MB_OK</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170241583191" role="tablecontent" localize="false" xml-lang="en-US">0</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3147397" role="paragraph" xml-lang="en-US">Display OK button only.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170241583930" role="tablecontent" localize="false" xml-lang="en-US">MB_OKCANCEL</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170241598544" role="tablecontent" localize="false" xml-lang="en-US">1</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3145646" role="paragraph" xml-lang="en-US">Display OK and Cancel buttons.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170241591470" role="tablecontent" localize="false" xml-lang="en-US">MB_ABORTRETRYCANCEL</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170241592832" role="tablecontent" localize="false" xml-lang="en-US">2</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3149410" role="paragraph" xml-lang="en-US">Display Abort, Retry, and Ignore buttons.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170241594311" role="tablecontent" localize="false" xml-lang="en-US">MB_YESNOCANCEL</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170241594996" role="tablecontent" localize="false" xml-lang="en-US">3</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3151075" role="paragraph" xml-lang="en-US">Display Yes, No, and Cancel buttons.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170241596937" role="tablecontent" localize="false" xml-lang="en-US">MB_YESNO</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170241592706" role="tablecontent" localize="false" xml-lang="en-US">4</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3153878" role="paragraph" xml-lang="en-US">Display Yes and No buttons.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170241591119" role="tablecontent" localize="false" xml-lang="en-US">MB_RETRYCANCEL</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170241595093" role="tablecontent" localize="false" xml-lang="en-US">5</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3155601" role="paragraph" xml-lang="en-US">Display Retry and Cancel buttons.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id05122017024159933" role="tablecontent" localize="false" xml-lang="en-US">MB_ICONSTOP</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id05122017024159655" role="tablecontent" localize="false" xml-lang="en-US">16</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3150716" role="paragraph" xml-lang="en-US">Add the Stop icon to the dialog.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170241591424" role="tablecontent" localize="false" xml-lang="en-US">MB_ICONQUESTION</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170241593191" role="tablecontent" localize="false" xml-lang="en-US">32</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3153837" role="paragraph" xml-lang="en-US">Add the Question icon to the dialog.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170241598357" role="tablecontent" localize="false" xml-lang="en-US">MB_ICONEXCLAMATION</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170242002870" role="tablecontent" localize="false" xml-lang="en-US">48</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3150751" role="paragraph" xml-lang="en-US">Add the Exclamation Point icon to the dialog.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170242001511" role="tablecontent" localize="false" xml-lang="en-US">MB_ICONINFORMATION</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170242008091" role="tablecontent" localize="false" xml-lang="en-US">64</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3146915" role="paragraph" xml-lang="en-US">Add the Information icon to the dialog.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170242003564" role="tablecontent" localize="false" xml-lang="en-US"> </paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170242001398" role="tablecontent" localize="false" xml-lang="en-US">128</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3145640" role="paragraph" xml-lang="en-US">First button in the dialog as default button.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170242007839" role="tablecontent" localize="false" xml-lang="en-US">MB_DEFBUTTON2</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170242005589" role="tablecontent" localize="false" xml-lang="en-US">256</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3153765" role="paragraph" xml-lang="en-US">Second button in the dialog as default button.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id051220170242005074" role="tablecontent" localize="false" xml-lang="en-US">MB_DEFBUTTON3</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id051220170242001655" role="tablecontent" localize="false" xml-lang="en-US">512</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id3153715" role="paragraph" xml-lang="en-US">Third button in the dialog as default button.</paragraph>
    </tablecell>
  </tablerow>
</table>

<embed href="text/sbasic/shared/00000003.xhp#errorcode"/>
<embed href="text/sbasic/shared/00000003.xhp#err5"/>

<paragraph id="hd_id3150715" role="heading" level="2" xml-lang="en-US">Example:</paragraph>
<bascode>
<paragraph id="par_idm1340869408" role="bascode" localize="false" xml-lang="en-US">Sub ExampleMsgBox</paragraph>
<paragraph id="par_id3150327" role="bascode" xml-lang="en-US"> Const sText1 = "An unexpected error occurred."</paragraph>
<paragraph id="par_id3146912" role="bascode" xml-lang="en-US"> Const sText2 = "The program execution will continue, however."</paragraph>
<paragraph id="par_id3154757" role="bascode" xml-lang="en-US"> Const sText3 = "Error"</paragraph>
<paragraph id="par_idm1340862944" role="bascode" localize="false" xml-lang="en-US"> MsgBox(sText1 + Chr(13) + sText2,16,sText3)</paragraph>
<paragraph id="par_id051220170312352138" role="bascode" localize="false" xml-lang="en-US"> MsgBox(sText1 + Chr(13) + sText2, MB_ICONSTOP, sText3)</paragraph>
<paragraph id="par_idm1340861680" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph>
</bascode>
</body>

</helpdocument>