[Solved] Opening a Dialog thats in a calc file

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Harold
Posts: 3
Joined: Sat Apr 26, 2008 11:24 pm

[Solved] Opening a Dialog thats in a calc file

Post by Harold »

i want to open a dialog, and in a book i have this was the way they explained it, but it called on a dialog in the default directory, and my dialog sits in a file.
"Input" is the library name inside the file, "InputWindow" is the name of my dialog, how do i get to make the macro open the dialog?

Code: Select all

Option Explicit

Dim oInput as Object

Sub Main

	show_input_window
	
End Sub


Sub show_input_window

	basicLibraries.LoadLibrary("Input")
	oInput = loadDialog("Input" , "InputWindow")
	oInput.execute
	
End Sub
	
Last edited by Harold on Sun Apr 27, 2008 8:19 am, edited 1 time in total.
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Opening a Dialog thats in a calc file

Post by Villeroy »

There are basic libraries and dialog libraries separated from each other although modules and dialogs are shown together in one row of tabs.

Code: Select all

REM  *****  BASIC  *****

Sub Main
REM only libraries named "Standard" get loaded automatically
thisComponent.DialogLibraries.loadLibrary("Library1")
oDlg = CreateUnoDialog(thisComponent.DialogLibraries.Library1.Dialog1)
REM my dialog has one button of button type "OK", which makes .execute() return 1:
X = oDlg.execute()
if X = 1 then
	msgbox "Closed through some button of type 'OK'"
else
	msgbox "Canceled"
endif
End Sub
See also online help on "CreateUnoDialog function".
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Harold
Posts: 3
Joined: Sat Apr 26, 2008 11:24 pm

Re: [Solved] Opening a Dialog thats in a calc file

Post by Harold »

yeah that did the trick, thanks a bundle :)
Post Reply