Opening a Dialog With Program Code/text/sbasic/guide/show_dialog.xhpmodule/dialog toggledialogs;using program code to show (example)examples; showing a dialog using program codemw changed "modules and dialogs;"Opening a Dialog With Program Code
In the %PRODUCTNAME BASIC window for a dialog that you created, leave the dialog editor by clicking the name tab of the Module that the dialog is assigned to. The name tab is at the bottom of the window.Enter the following code for a subroutine called Dialog1Show. In this example, the name of the dialog that you created is "Dialog1":Sub Dialog1ShowBasicLibraries.LoadLibrary("Tools")oDialog1 = LoadDialog("Standard", "Dialog1")oDialog1.Execute()End SubWithout using "LoadDialog" you can call the code as follows:Sub Dialog1ShowDialogLibraries.LoadLibrary( "Standard" )oDialog1 = CreateUnoDialog( DialogLibraries.Standard.Dialog1 )oDialog1.Execute()End SubWhen you execute this code, "Dialog1" opens. To close the dialog, click the close button (x) on its title bar.