How to form.open in same window

Creating and using forms
Post Reply
Colkard
Posts: 9
Joined: Wed Nov 09, 2016 10:52 am

How to form.open in same window

Post by Colkard »

Hi,
I have 3 Forms:
-Formulario Factura
-Formulario VerFacturas
-Formulario Anyo
The first one is Anyo that has a button to open the form "Formulario VerFacturas", but when I click on the button to open the form, it opens on new window, and the same happends when I try to open the next form (Formulario Factura).
And my question is: How can i do to form.open in the same window.
One example of my code that does this:

Code: Select all

Sub VerFacturasDeAnyo (event as Object)
	Dim Doc As Object
	Dim Controller As Object
	Dim oLbanyoLBCM As Object
	'Const sNewDocumentName="Formulario VerFacturas"
	Doc = ThisComponent
	oForm = Doc.DrawPage.Forms.GetByIndex(0)
	oLbanyo = oForm.getByName ( "lb_anyo" )
	Controller = ThisComponent.getCurrentController()
	oLbanyoLBCM = Controller.getControl(oLbanyo)
	sAnyoselec = oLbanyoLBCM.getSelectedItem()
	'MsgBox sAnyoselec
	'oNewFormDocument=ThisDatabaseDocument.FormDocuments.getbyname(sNewDocumentName).open
	ThisDatabaseDocument.FormDocuments.GetByName("Formulario VerFacturas").Open 'I tried the commented lines and this, but both do the same.
End Sub
To be clear, is like on a html file, when u want to open a link in other tab u make this "target='_blank'" (this is what actually my code does),
and what I really want is this: "target='_self'"
Thanks for helping!!! :D
OpenOffice 4.1.3 on Windows Server 2012 R2 Standard
UnklDonald418
Volunteer
Posts: 1549
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: How to form.open in same window

Post by UnklDonald418 »

How can i do to form.open in the same window
The short answer is that you can't. A Form is a window.
It isn't clear what you are trying to accomplish.
Do you want to tile the forms so they both appear but don't overlap?
Do you want to replace one with the other?
Otherwise all your forms must be combined into one form. Then you could toggle the Enabled or Visible properties on the controls you want to limit access to.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to form.open in same window

Post by Villeroy »

He wants to open a new form based on a record of the current form instead of simply using subforms within the same document. And yes, you may even use many interrelated logical forms on the same form document and navigate between them through bookmarks. In the end it is just an ordinary text document.
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
Colkard
Posts: 9
Joined: Wed Nov 09, 2016 10:52 am

Re: How to form.open in same window

Post by Colkard »

Hi all,
I want that when I open a form with a button from a form, make it overlay the first one (not replace).
UnklDonald418 wrote:Otherwise all your forms must be combined into one form. Then you could toggle the Enabled or Visible properties on the controls you want to limit access to.
If there is no other solution, I think this will be my solution but I have to make "a lot" of changes on my forms to do this and would be labour-intensive :(

I'll let you my odb file for helping to understand what I want.

PD: The only one form that should be oppened by the final user, must be "Formulario Anyo" and from it, navigate with buttons to the others (to go from the second form to the first you have to close it buy close-titlebar cross).
Attachments
Cuentas.zip
All data is for testing (for now no real data introduced)
(43.75 KiB) Downloaded 193 times
OpenOffice 4.1.3 on Windows Server 2012 R2 Standard
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to form.open in same window

Post by Villeroy »

This could be solved less labour-intensively without any macro code but with a more complex form layout.
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
Post Reply