Paolo Mantovani schrieb:
Hi,

Carsten Driesner ha scritto:
[...]
Third (and last for now): com.sun.star.awt.UnoControlContainer and
com.sun.star.awt.UnoControlContainerModel go beyond my understanding,
although I've been using them so far this way

- instantiate both at the global service manager
- set the model at the control
- add the control to a parent XControlContainer

It turns out that the model can be instantiated at the dialog model's
XMultiServiceManager (obviously just because it supports
UnoControlModel), and then be inserted by name in the dialog model's
XNameContainer.
But when the control model is instantiated this way, there is no control
at all: XControlContainer::getControl() at the UnoControlDialog returns
null.
The control is the "view" of the control model. If you insert a model
there is no view. The view will be created on demand when you call
execute() at XDialog.

Hi Paolo,

I didn't catch that we talk about the UnoControlContainerModel as a "normal" control. It's simple, you cannot nest UnoControlContainerModel. Although you can add it them into a container model, they won't do anything useful. May be the creator of the toolkit project had something in mind with this specialty, I don't know.

In my test, the result is a null reference, before and after the
execute() call:

---------------------------------------------
REM  *****  BASIC  *****

Sub Main

oDlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
oCCM =
oDlg.Model.createInstance("com.sun.star.awt.UnoControlContainerModel")
With oCCM
        .PositionX = 10
        .PositionY = 10
        .Width = 45
        .Height = 14
End With
oDlg.Model.insertByName("CC", oCCM)

'test before execute
Print IsNull(oDlg.getControl("CC"))

oDlg.execute

'test after execute
Print IsNull(oDlg.getControl("CC"))

End Sub
---------------------------------------------

Trying the same test with ordinary controls (controls that are listed in
the dialog-model service manager) you will obtain a valid reference to
the control-view in both cases (before and after the execute() call)
Ok, something that I missed. Up to now I thought that controls are only created on demand. Looks like getControl() is also a trigger for on-demand creation.

Regards,
Carsten

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

Reply via email to