URL setting to open Form from a button

Creating and using forms
Post Reply
User avatar
charlie.it
Volunteer
Posts: 417
Joined: Wed Aug 21, 2013 2:12 pm
Location: Italy

URL setting to open Form from a button

Post by charlie.it »

Ciao to all.
I know I can assign the Opendocument / web page action to the Action property of a button.
I also know that if I set the URL ".uno: CloseWin", clicking the button will close the form window.
Is there a URL setting that opens another form to me without having to resort to a macro?
Thank you.
charlie
Italian AOO Admin
macOS 14 Sonoma M1: Open Office 4.1.15 - LibreOffice 7.5.7.1

http://www.charlieopenoffice.altervista.org
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: URL setting to open Form from a button

Post by RoryOF »

Why not select two button actions - button down closes form, button up opens new form?
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: URL setting to open Form from a button

Post by Villeroy »

Save the forms as stand-alone Writer documents. Then you can open them with plain file: URL hyperlinks or hyperlink buttons.
Embedded forms always require a macro like this one:

Code: Select all

Sub OpenEmbedded(odb, sHierachicalName$, bReport As Boolean)
	view = odb.CurrentController
	con = view.ActiveConnection
	if isNull(con) then view.connect()
	if bReport then
		container = odb.ReportDocuments
	else	
		container = odb.FormDocuments
	endif
	obj = container.getByHierarchicalName(sHierachicalName)
	obj.open()
End Sub
The above macro handles forms and reports by hierarchical names including any folder names.
For instance:

Code: Select all

Sub OpenTaxForm()
GlobalScope.BasicLibraries.loadLibrary("DBA")
OpenEmbedded ThisDatabaseDocuent, "Setup/TaxForm", False
End Sub
ThisDatabaseDocument is the odb embedding the macro and the form, the second argument refers to "TaxForm" in subfolder "Setup", Third argument is False and True when loading a report.
"DBA" (database access) is the name of a library in "MyMacros" where the generic macro is stored.
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
User avatar
charlie.it
Volunteer
Posts: 417
Joined: Wed Aug 21, 2013 2:12 pm
Location: Italy

Re: URL setting to open Form from a button

Post by charlie.it »

RoryOF wrote:Why not select two button actions - button down closes form, button up opens new form?
That's what I was asking, if there is a ".uno: xxxx" to open another existing form, but Villeroy says no.
Villeroy wrote:Save the forms as stand-alone Writer documents. Then you can open them with plain file: URL hyperlinks or hyperlink buttons
I Knew it, thanks.
Villeroy wrote:Embedded forms always require a macro
I hoped not, thanks.
charlie
Italian AOO Admin
macOS 14 Sonoma M1: Open Office 4.1.15 - LibreOffice 7.5.7.1

http://www.charlieopenoffice.altervista.org
Post Reply