Can I open the form from a macro in the same window?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
NiksaVel
Posts: 91
Joined: Fri Jan 25, 2008 12:00 pm
Location: Croatia

Can I open the form from a macro in the same window?

Post by NiksaVel »

Well.. the subject pretty much said it all... I'd like to get a browser-like functionality when navigating through different forms via buttons I use the following script:

Code: Select all

    REM Generic macros needed to open any form
    function OpenForm( formContainer as variant, oConnection as variant, sFormName as string) as variant
    Dim aProp(1) As New com.sun.star.beans.PropertyValue
    aProp(0).Name = "ActiveConnection"
    aProp(0).Value = oConnection
    aProp(1).Name = "OpenMode"
    aProp(1).Value = "open"
    OpenForm = formContainer.loadComponentFromURL(sFormName,"_blank",0,aProp())
    end function

    function getFormsTC() as variant
    getFormsTC = thisComponent.Parent.getFormDocuments
    end function

    function getConnectionTC() as variant
    getConnectionTC = thisComponent.Drawpage.Forms(0).ActiveConnection
    end function


    sub OpenForm_Button_Click( oev as variant )
    sFormName = oev.Source.Model.Tag
    OpenForm( getFormsTC, getConnectionTC, sFormName )
    end sub

but I get all the forms opened in a new window... I guess this is due to the _blank argument...

I've tried replacing it with _self or _parent, but nothing happened... help? :D
OOo 3.1.X on Ubuntu 8.x + Linux Mint 7, Win XP, Vista
User avatar
foxcole
Volunteer
Posts: 1507
Joined: Mon Oct 08, 2007 1:31 am
Location: Minneapolis, Minnesota

Re: Can I open the form from a macro in the same window?

Post by foxcole »

You question was posted several months ago. Did you ever find a solution?
Cheers!
---Fox

OOo 3.2.0 Portable, Windows 7 Home Premium 64-bit
B Marcelly
Volunteer
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: Can I open the form from a macro in the same window?

Post by B Marcelly »

Hi,
The answer is in this page of the Developer's Guide. In this case it is a simplified loadComponentFromURL : second and third arguments are not used, and the aProp() argument can only use the two properties ActiveConnection and OpenMode.
______
Bernard
Post Reply