Hallo all,

Thanks to what i learned from Frank and Ariel i can open a DataSourceBrowser in a UNO Dialog doing the same for a FormGridView fails in a way that the FormGridView opens in the dialog but without data ?

Wath I am doing is loading a ".component:DB/FormGridView" in a UNO Dialog ControlFrame using the same mediadescriptor (LoaderArguments) as for the DataSource Browser, wath are I missing??

the code based on the work of Ariel Constenla-Haile

Sub DataSourceBrowser_FrameControl

   Dim oDlg as Object, oGhost as Object, oFrameControl as Object
   Dim aPosSize
   Dim oFrame as Object, oController as Object, oModel as Object
DialogLibraries.loadLibrary("Standard") oDlg = createUnoDialog(DialogLibraries.Standard.DBTABLEPREVIEWDIALOG) ' dialog with a Frame_control init namend "WIN_BEAMER oGhost = oDlg.getControl("WIN_BEAMER")
   aPosSize = oGhost.getPosSize()
oFrameControl = createUnoService("com.sun.star.frame.FrameControl")

   oDlg.addControl("FRAME_CTRL", oFrameControl)
oFrameControl.setPosSize(aPosSize.X, aPosSize.Y, aPosSize.Width, aPosSize.Height, _
                               com.sun.star.awt.PosSize.POSSIZE)
Dim aLoaderArguments(5) as New com.sun.star.beans.PropertyValue
   aLoaderArguments(0).Name = "DataSourceName"
   aLoaderArguments(0).Value = "MyRegisteredDatabase"
   aLoaderArguments(1).Name = "CommandType"
   aLoaderArguments(1).Value = com.sun.star.sdb.CommandType.TABLE
   aLoaderArguments(2).Name = "Command"
   aLoaderArguments(2).Value = "My_table"
aLoaderArguments(3).Name = "ShowTreeView"
   aLoaderArguments(3).Value = FALSE
   aLoaderArguments(4).Name = "ShowTreeViewButton"
   aLoaderArguments(4).Value = FALSE
   aLoaderArguments(5).Name = "ShowMenu"
   aLoaderArguments(5).Value = FALSE
'This property is not documented in the IDL 'http://api.openoffice.org/docs/common/ref/com/sun/star/frame/FrameControl.html
   oFrameControl.LoaderArguments = aLoaderArguments
' oFrameControl.ComponentUrl = ".component:DB/DataSourceBrowser"
oFrameControl.ComponentUrl = ".component:DB/FormGridView"
   oFrame = oFrameControl.Frame
   If NOT IsNull(oFrame) Then
       oController = oFrame.Controller
       If NOT IsNull(oController) Then
           oModel = oController.Model
           If NOT IsNull(oModel) Then'here is NULL: the DSB has no model
               '...
           End If
       End If
   End If
End Sub

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org
For additional commands, e-mail: dev-h...@dba.openoffice.org

Reply via email to