Le 2005-02-01 12:59, sos a �crit :
Paolo,
I tryed the workaroun from frank

 ocontrol = oDataSourceBrowser.getCurrentControl()
  omodel = ocontrol.getModel.getParent

and that gives what i wanted.


I could use Paolo's method, see macro hereunder.
But there is still a nasty problem: the positions obtained seem to include "inactive records" of the base. For example in the Bibliography table if you select all lines you get positions 1, and 25 to 36 which are out of limit.
I ran into the same problem with a personal base (dBase) and looking for selected lines in a grid control of a form.
Bernard



Sub mySelectionOfDataBrowser Dim frame1 As Object, frame2 As Object Dim oModel As Object Dim oResults As Object Dim oGrid As Object Dim oDoc as object Dim oDataSourceBrowser as Object Dim oSelection as Variant Dim ii As Long

oDoc = thiscomponent
frame1 = oDoc.CurrentController.Frame
frame2 = frame1.findFrame("_beamer",4)
if IsNull(frame2) then
  MsgBox("Beamer not found !", 16)
  Exit Sub
end if
oDataSourcebrowser = frame2.Controller
oModel = oDataSourcebrowser.com_sun_star_awt_XTabController_getModel
oResults = oModel.createResultSet
oGrid = oDataSourceBrowser.CurrentControl
oSelection = oGrid.Selection
if UBound(oSelection) >= 0 then
  For ii= 0 To UBound(oSelection)
    if oResults.absolute(oSelection(ii)) then
      MsgBox( oResults.Columns(0).String & " : " & _
              oResults.Columns(4).String )
    else
      MsgBox("Position not found : " & oSelection(ii), 16)
    end if
  Next
else
  MsgBox("No line selected in beamer", 16)
end if
End Sub


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to