Here you'll find an OOBasic "translation" of the example in the IDL documentation for the service com.sun.star.form.PropertyBrowserController.
The code does the following operations:
- creates a new container window
- creates a new empty frame and set the container window on it
- creates the Property Browser controller and attach it on the frame
- finally, takes an UNO control model as "introspectedObject" and shows it's properties and events
To see it working:
Open the OOBasic IDE, add a new empty dialog (this will be the introspected Object) and run the following code:
REM ***** BASIC *****
Sub ShowPropertyBrowser()
' Create a rectangle struct
Dim aRect As New {@see com.sun.star.awt.Rectangle}
aRect.Y = 0
aRect.X = 0
aRect.width = 350
aRect.height = 550
' Create a window descriptor and set up its properties
Dim aDescriptor As New {@see com.sun.star.awt.WindowDescriptor}
aDescriptor.Type = {@see com.sun.star.awt.WindowClass:TOP}
' aDescriptor.WindowServiceName = "window"
' aDescriptor.ParentIndex = -1
' aDescriptor.Parent = Null 'not available in OOBasic
aDescriptor.Bounds = aRect
aDescriptor.WindowAttributes = _
{@see com.sun.star.awt.WindowAttribute:BORDER} + _
{@see com.sun.star.awt.WindowAttribute:MOVEABLE} + _
{@see com.sun.star.awt.WindowAttribute:SIZEABLE} + _
{@see com.sun.star.awt.WindowAttribute:CLOSEABLE}
' Use a Toolkit to create a Window
oToolkit = createUnoService("{@see com.sun.star.awt.Toolkit}")
oContainerWindow = oToolkit.createWindow(aDescriptor)
' Create a new empty target frame.
oFrame = createUnoService("{@see com.sun.star.frame.Frame}")
' Set the container window on it.
oFrame.initialize(oContainerWindow)
' Insert the new frame in desktop hierarchy.
oFrameContainer = StarDesktop.getFrames()
oFrameContainer.append(oFrame)
' Make some other initializations.
oFrame.Name = "newly created 1"
oFrame.Title = "newly created 1"
oContainerWindow.setVisible(True)
' Create the Property Browser Controller
oPropBrowser = CreateUnoService("{@see com.sun.star.form.PropertyBrowserController}")
oPropBrowser.attachFrame(oFrame)
' Now we have a component window !
' Make it visible
oFrame.ComponentWindow.setVisible(True)
' Retrieve an UNO Control Model
oDlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
oCtrlModel = oDlg.getModel
'also Form Controls works well(obvious)
' oCtrlModel = ThisComponent.DrawPage.Forms.Standard.PushButton
' Show Control properties in the browser
oPropBrowser.introspectedObject = oCtrlModel
End Sub