<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.harlamenkov.ru/index.php?action=history&amp;feed=atom&amp;title=EN%2Fdocumentation%2Fbasic_guide%2Fworking_with_dialogs</id>
	<title>EN/documentation/basic guide/working with dialogs - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.harlamenkov.ru/index.php?action=history&amp;feed=atom&amp;title=EN%2Fdocumentation%2Fbasic_guide%2Fworking_with_dialogs"/>
	<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/working_with_dialogs&amp;action=history"/>
	<updated>2026-11-11T14:07:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.0</generator>
	<entry>
		<id>https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/working_with_dialogs&amp;diff=16634&amp;oldid=prev</id>
		<title>Sancho: Основной текст</title>
		<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/working_with_dialogs&amp;diff=16634&amp;oldid=prev"/>
		<updated>2011-09-05T17:31:44Z</updated>

		<summary type="html">&lt;p&gt;Основной текст&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;section begin=title /&amp;gt;&amp;lt;noinclude&amp;gt;{{DISPLAYTITLE:&amp;lt;/noinclude&amp;gt;Working With Dialogs&amp;lt;noinclude&amp;gt;}}&amp;lt;/noinclude&amp;gt;&amp;lt;section end=title /&amp;gt;{{BreadCrumbL10n}}&lt;br /&gt;
&lt;br /&gt;
{{Documentation/BASICGuideTOC&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=EN/documentation/basic_guide/dialogs&lt;br /&gt;
|NextPage=EN/documentation/basic_guide/properties&lt;br /&gt;
|dial=block&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic dialogs consist of a dialog window that can contain text fields, list boxes, radio buttons, and other control elements.&lt;br /&gt;
&lt;br /&gt;
== Creating Dialogs ==&lt;br /&gt;
&lt;br /&gt;
You can create and structure dialogs using the {{OOo}} dialog editor:&lt;br /&gt;
&lt;br /&gt;
[[Image:documentation_basicguide_dlg_01.gif|none|thumb|500px|Create and structure dialogs in the dialog editor]]&lt;br /&gt;
&lt;br /&gt;
You can drag the control elements from the design pallet (right) into the dialog area, and define their position and size.&lt;br /&gt;
&lt;br /&gt;
The example shows a dialog that contains a label and a list box.&lt;br /&gt;
&lt;br /&gt;
[[Image:documentation_basicguide_dlg_04.gif|none|thumb|500px|A dialog containing a label and a list box]]&lt;br /&gt;
&lt;br /&gt;
You can open a dialog with the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Dlg As Object&lt;br /&gt;
&lt;br /&gt;
DialogLibraries.LoadLibrary(&amp;quot;Standard&amp;quot;)&lt;br /&gt;
Dlg = CreateUnoDialog(DialogLibraries.Standard.DlgDef)&lt;br /&gt;
Dlg.Execute()&lt;br /&gt;
Dlg.dispose()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;CreateUnoDialog&amp;lt;/tt&amp;gt; creates an object called &amp;lt;tt&amp;gt;Dlg&amp;lt;/tt&amp;gt; that references the associated dialog. Before you can create the dialog, you must ensure that the library it uses (in this example, the &amp;lt;tt&amp;gt;Standard&amp;lt;/tt&amp;gt; library) is loaded. The &amp;lt;tt&amp;gt;LoadLibrary&amp;lt;/tt&amp;gt; method performs this task.&lt;br /&gt;
&lt;br /&gt;
Once the &amp;lt;tt&amp;gt;Dlg&amp;lt;/tt&amp;gt; dialog object has been initialized, you can use the &amp;lt;tt&amp;gt;Execute&amp;lt;/tt&amp;gt; method to display the dialog. Dialogs such as this one are described as modal because they do not permit any other program action until they are closed. While this dialog is open, the program remains in the &amp;lt;tt&amp;gt;Execute&amp;lt;/tt&amp;gt; call.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;dispose&amp;lt;/tt&amp;gt; method at the end of the code releases the resources used by the dialog once the program ends.&lt;br /&gt;
&lt;br /&gt;
== Closing Dialogs ==&lt;br /&gt;
&lt;br /&gt;
=== Closing With OK or Cancel ===&lt;br /&gt;
&lt;br /&gt;
If a dialog contains an '''OK''' or a '''Cancel''' button, the dialog is automatically closed when you click one of these buttons. More information about working with these buttons is discussed in [[Documentation/BASIC Guide/Control Elements|Dialog Control Elements in Detail]].&lt;br /&gt;
&lt;br /&gt;
If you close a dialog by clicking the '''OK''' button, the &amp;lt;tt&amp;gt;Execute&amp;lt;/tt&amp;gt; method returns a return value of 1, otherwise a value of 0 is returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Dlg As Object&lt;br /&gt;
&lt;br /&gt;
DialogLibraries.LoadLibrary(&amp;quot;Standard&amp;quot;)&lt;br /&gt;
Dlg = CreateUnoDialog(DialogLibraries.Standard.MyDialog)&lt;br /&gt;
Select Case Dlg.Execute() &lt;br /&gt;
Case 1&lt;br /&gt;
  MsgBox &amp;quot;Ok pressed&amp;quot;&lt;br /&gt;
Case 0 &lt;br /&gt;
  MsgBox &amp;quot;Cancel pressed&amp;quot;&lt;br /&gt;
End Select&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Closing With the Close Button in the Title Bar ===&lt;br /&gt;
&lt;br /&gt;
You can close a dialog by clicking the close button on the title bar of the dialog window. The &amp;lt;tt&amp;gt;Execute&amp;lt;/tt&amp;gt; method of the dialog returns the value 0, which is the same as when you click Cancel.&lt;br /&gt;
&lt;br /&gt;
=== Closing With an Explicit Program Call ===&lt;br /&gt;
&lt;br /&gt;
You can also close an open dialog window with the &amp;lt;tt&amp;gt;endExecute&amp;lt;/tt&amp;gt; method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dlg.endExecute()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The Execute method of the dialog returns the value 0, which is the same as when you click Cancel.&lt;br /&gt;
&lt;br /&gt;
== Access to Individual Control Elements ==&lt;br /&gt;
&lt;br /&gt;
A dialog can contain any number of control elements. You can access these elements through the &amp;lt;tt&amp;gt;getControl&amp;lt;/tt&amp;gt; method that returns the control element by name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Ctl As Object&lt;br /&gt;
&lt;br /&gt;
Ctl = Dlg.getControl(&amp;quot;MyButton&amp;quot;)&lt;br /&gt;
Ctl.Label = &amp;quot;New Label&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code determines the object for the &amp;lt;tt&amp;gt;MyButton&amp;lt;/tt&amp;gt; control element and then initializes the &amp;lt;tt&amp;gt;Ctl&amp;lt;/tt&amp;gt; object variable with a reference to the element. Finally the code sets the &amp;lt;tt&amp;gt;Label&amp;lt;/tt&amp;gt; property of the control element to the &amp;lt;tt&amp;gt;New Label&amp;lt;/tt&amp;gt; value.&lt;br /&gt;
&lt;br /&gt;
{{Note|Unlike {{OOo}} Basic identifiers, the names of control elements are case sensitive.}}&lt;br /&gt;
&lt;br /&gt;
== Working With the Model of Dialogs and Control Elements ==&lt;br /&gt;
&lt;br /&gt;
The division between visible program elements ('''View''') and the data or documents behind them ('''Model''') occurs at many places in {{OOo}} API. In addition to the methods and properties of control elements, both dialog and control element objects have a subordinate &amp;lt;tt&amp;gt;Model&amp;lt;/tt&amp;gt; object. This object allows you to directly access the content of a dialog or control element.&lt;br /&gt;
&lt;br /&gt;
In dialogs, the distinction between data and depiction is not always as clear as in other API areas of {{OOo}}. Elements of the API are available through both the View and the Model.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Model&amp;lt;/tt&amp;gt; property provides program-controlled access to the model of dialog and control element objects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim cmdNext As Object&lt;br /&gt;
&lt;br /&gt;
cmdNext = Dlg.getControl(&amp;quot;cmdNext&amp;quot;)&lt;br /&gt;
cmdNext.Model.Enabled = False&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example deactivates the &amp;lt;tt&amp;gt;cmdNext&amp;lt;/tt&amp;gt; button in the &amp;lt;tt&amp;gt;Dlg&amp;lt;/tt&amp;gt; dialog with the aid of the model object from &amp;lt;tt&amp;gt;cmdNext&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Sancho</name></author>
		
	</entry>
</feed>