Frank an others ,
I worked out to get acces to the DataSourceBrowser component and folowed the instructions of Frank (below) to get acces to the data whos is selected by as user in a open DataSourceBrowser. But when tryien tho het the "model" of this open DataSourceBrowser i get a "null object" as repons ?
Did i defiend the oModel object in a wrong way has it to be somtingth like a new com.sun.star.sdb.DataForm ?
Mi testcode can be run after you opens a DSB in a writerdocument
sub test
Dim cntrlr As Object
Dim frame1 As Object, frame2 As Object
Dim url As new com.sun.star.util.URL
Dim oModel As Object
Dim oResults As Object
Dim oController As Object, oCtrll As Object
dim oDoc as object
dim oDataSourceBrowser as Object
dim oSelection as Object
oDoc = thiscomponent
cntrlr = oDoc.getCurrentController()
frame1 = StarDesktop.getCurrentFrame()
frame2 = frame1.findFrame("_beamer",4)
oDataSourcebrowser = frame2.getController()
' xray.xray oDataSourceBrowser
oCtrll = oDataSourceBrowser.getCurrentControl()
oSelection = oCtrll.GetSelection()
' For ii=LBound(oSelection) To UBound(oSelection)
' Print oSelection(ii)
' Next
oDataSourceBrowser.getModel(oModel)
xray.xray oModel >>>>>>>>>>>>>>>>>>>gives "null object"
' MsgBox( oTest.Name )oResults = oModel.createResultSet()
end sub
At 17:40 25/01/05, you wrote:
Hello Fernand,
> Need some information in basic code to get acces to multi selected lines > in the DataSourceBrowser.
out of my head, completely untested, and written in some pidgin basic:
oDataSourceBrowser ' the component in the small ' "data source browser" frame .getControls() ' all controls in the responsibility ' of this XFormController (0) ' the first control (which is a ' css.sdb.control.GridControl) .getSelection ' the current selection in this control
The selection should contain an array of integer values, denoting absolute positions within the com.sun.star.sdb.DataForm. To use those positions, do
oDataSourecBrowser ' as above .getModel() ' the form which is currently loaded ' into the DSB .createResultSet() ' a "clone" of the form, which can be ' operated without affecting the form ' itself .absolute( position ) ' move the result set to the given ' position, which is one of the integer ' values from the selection
Something like this :)
Ciao Frank
-- - Frank Sch�nheit, Software Engineer, OpenOffice.org Database Access - - [EMAIL PROTECTED] http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--------------------------------------------------------------------- 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]
