How to form.open in same window

Creating and using forms

How to form.open in same window

Postby Colkard » Wed Nov 09, 2016 11:05 am

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   Expand viewCollapse view
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
Colkard
 
Posts: 9
Joined: Wed Nov 09, 2016 10:52 am

Re: How to form.open in same window

Postby UnklDonald418 » Wed Nov 09, 2016 9:57 pm

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.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1326
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: How to form.open in same window

Postby Villeroy » Wed Nov 09, 2016 10:14 pm

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28559
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to form.open in same window

Postby Colkard » Fri Nov 11, 2016 11:36 am

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 89 times
OpenOffice 4.1.3 on Windows Server 2012 R2 Standard
Colkard
 
Posts: 9
Joined: Wed Nov 09, 2016 10:52 am

Re: How to form.open in same window

Postby Villeroy » Fri Nov 11, 2016 3:43 pm

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28559
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Forms

Who is online

Users browsing this forum: No registered users and 2 guests