Difference between revisions of "Documentation/DevGuide/Basic/Showing a Dialog"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (FINAL VERSION FOR L10N)
m
 
Line 10: Line 10:
 
After a dialog has been designed using the dialog editor, a developer wants to show the dialog from within the program code. The necessary steps are shown in the following example:  
 
After a dialog has been designed using the dialog editor, a developer wants to show the dialog from within the program code. The necessary steps are shown in the following example:  
 
<!--[SOURCE:BasicAndDialogs/ToolkitControls]-->
 
<!--[SOURCE:BasicAndDialogs/ToolkitControls]-->
 
+
<source lang="oobas">
 
   Sub ShowDialog()
 
   Sub ShowDialog()
 
       Dim oLibContainer As Object, oLib As Object
 
       Dim oLibContainer As Object, oLib As Object
Line 30: Line 30:
 
       oDialog.execute()
 
       oDialog.execute()
 
   End Sub
 
   End Sub
 
+
</source>
 
The dialog control is created by calling the runtime function <code>CreateUnoDialog()</code> which takes an object as parameter that supports the <idl>com.sun.star.io.XInputStreamProvider</idl> interface. This object provides an input stream that represents an XML description of the dialog. The section [[Documentation/DevGuide/Basic/Advanced Library Organization|Advanced Library Organization]] explains the accessing to the object inside the library hierarchy. The dialog control is shown by calling the <code>execute()</code> method of the <idl>com.sun.star.awt.XDialog</idl> interface. It can be closed by calling <code>endExecute()</code>, or by offering a '''Cancel''' or '''OK''' Button on the dialog. For additional information, see [[Documentation/DevGuide/Basic/Programming Dialogs and Dialog Controls|Programming Dialogs and Dialog Controls]].
 
The dialog control is created by calling the runtime function <code>CreateUnoDialog()</code> which takes an object as parameter that supports the <idl>com.sun.star.io.XInputStreamProvider</idl> interface. This object provides an input stream that represents an XML description of the dialog. The section [[Documentation/DevGuide/Basic/Advanced Library Organization|Advanced Library Organization]] explains the accessing to the object inside the library hierarchy. The dialog control is shown by calling the <code>execute()</code> method of the <idl>com.sun.star.awt.XDialog</idl> interface. It can be closed by calling <code>endExecute()</code>, or by offering a '''Cancel''' or '''OK''' Button on the dialog. For additional information, see [[Documentation/DevGuide/Basic/Programming Dialogs and Dialog Controls|Programming Dialogs and Dialog Controls]].
  

Latest revision as of 09:53, 22 October 2009



After a dialog has been designed using the dialog editor, a developer wants to show the dialog from within the program code. The necessary steps are shown in the following example:

  Sub ShowDialog()
      Dim oLibContainer As Object, oLib As Object
      Dim oInputStreamProvider As Object
      Dim oDialog As Object
      Const sLibName = "Library1"
      Const sDialogName = "Dialog1"
      REM library container
      oLibContainer = DialogLibraries
      REM load the library
      oLibContainer.loadLibrary( sLibName )
      REM get library
      oLib = oLibContainer.getByName( sLibName )
      REM get input stream provider
      oInputStreamProvider = oLib.getByName( sDialogName )
      REM create dialog control
      oDialog = CreateUnoDialog( oInputStreamProvider )
      REM show the dialog
      oDialog.execute()
  End Sub

The dialog control is created by calling the runtime function CreateUnoDialog() which takes an object as parameter that supports the com.sun.star.io.XInputStreamProvider interface. This object provides an input stream that represents an XML description of the dialog. The section Advanced Library Organization explains the accessing to the object inside the library hierarchy. The dialog control is shown by calling the execute() method of the com.sun.star.awt.XDialog interface. It can be closed by calling endExecute(), or by offering a Cancel or OK Button on the dialog. For additional information, see Programming Dialogs and Dialog Controls.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages