Page 1 of 1

URL setting to open Form from a button

Posted: Sat Mar 28, 2020 5:32 pm
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.

Re: URL setting to open Form from a button

Posted: Sat Mar 28, 2020 5:38 pm
by RoryOF
Why not select two button actions - button down closes form, button up opens new form?

Re: URL setting to open Form from a button

Posted: Sat Mar 28, 2020 5:48 pm
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.

Re: URL setting to open Form from a button

Posted: Sat Mar 28, 2020 6:32 pm
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.