To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=52649
Issue #:|52649
Summary:|Opening a form an a Base document closes when the
|macro finishes.
Component:|api
Version:|680m120
Platform:|All
URL:|
OS/Version:|All
Status:|NEW
Status whiteboard:|
Keywords:|
Resolution:|
Issue type:|DEFECT
Priority:|P3
Subcomponent:|code
Assigned to:|sw
Reported by:|pitonyak
------- Additional comments from [EMAIL PROTECTED] Sat Jul 30 07:18:29 -0700
2005 -------
I open a form contained in a Base document using:
oFormDocs.loadComponentFromURL()
The form opens, but closes when the macro completes. See the complete macro
below. If I create an external variable that holds a reference to the document
definition, however, then the form stays open.
I discussed this with Frank Schönheit on the dba development mailing list, and
he had two comments:
1. He agrees that I should not have to hold a reference to the form definition
so that the form stays open. (This is the bug reported for this issue).
2. It seems silly that I need to provide an active connection. This active
connections may become a resource leak because it is not closed (this is
speculative of course).
Dim oXXX
Sub OpenFormInDB()
Dim s As String 'Temporary string variable.
Dim oDBDoc 'The database document that contains the form.
Dim oFormDef 'com.sun.star.sdb.DocumentDefinition of the form.
Dim oFormDocs 'The form documents container.
Dim oFormDoc 'The actual form document.
Dim oIHandler 'Interaction handler.
Dim oCon 'Database connection.
Dim oParms(1) As New com.sun.star.beans.PropertyValue
Dim oBaseContext 'Global database context service.
Dim oDataBase 'Database obtained from the database context.
Dim sFormName$
Dim sURL$
sFormName = "Inventory_Form1"
sURL = "file:///andrew0/home/andy/My%20Documents/Stamps_2005_07_22.odb"
oDBDoc = StarDesktop.loadComponentFromURL(sURL, "_blank", 0, Array())
oFormDocs = oDBDoc.getFormDocuments()
oFormDef = oDBDoc.getFormDocuments().getByName(sFormName)
REM Uncomment this next line to hold the form open
'oXXX = oFormDef
REM The database context is required for the connection.
oBaseContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")
oDataBase = oBaseContext.getByName(sUrl)
oCon = oDataBase.getConnection("", "")
oParms(0).Name = "OpenMode"
oParms(0).Value = "openDesign"
oParms(1).Name = "ActiveConnection"
oParms(1).Value = oCon
oFormDoc = oFormDocs.loadComponentFromURL(sFormName, "", 0, oParms())
End Sub
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]