Cor Nouws wrote:
> Hi *,
>
> I know how to set the visible sate of a control:
>
> oControlModel = oDocDlg.GetControl(sName)
> oControlModel.setVisible (sYesNo)
>
> but cannot find a methode (with xRay / API IDL) to
check if a control is
> visible ...
>
> Any hints welcome
> & Thanks,
> Cor
>
>
One problem I ran into regarding "setVisible()" is
that the visibility
of an UnoControl is not set persistently when you switch the
steps of
the dialog.
In the following code
oControl = oDialog.getControl("TextField1")
oControl.setVisible(false)
oDialog.Model.Step = 1
oDialog.Model.Step = 0
oDialog.execute()
the control "TextField1" will not be invisible,
because the steps of the
dialog have been set back and forth afterwards.
As I found out the most convenient workaround for this
problem is to
reserve an invisible Step where you park all your invisible
controls. I
know that this might appear like a hack but the advantage is
that you
don't have to check which controls have to be set invisible
each time
when you change the Step property at the dialog.
Public const INVISIBLESTEP = 99
...
oControl = oDialog.getControl("TextField1")
' Assign the value of the Step of your Control in the
"Tag" ' '
property of the control initially
oControl.Model.Tag = oControl.Model.Step
setVisible(oControl.Model, false)
Msgbox "Control is visible: " &
IsVisible(oControl.Model)
oDialog.Model.Step = 2
oDialog.Model.Step = 1
oDialog.execute()
...
public Sub setVisible(oControlModel, bIsVisible as Boolean)
if bIsVisible Then
oControlModel.Step = oControlModel.Tag
Else
oControlModel.Tag = oControlModel.Step
oControlModel.Step = INVISIBLESTEP
End If
End Sub
Public Function isVisible(oControlModel) as Boolean
isVisible() = Not (oControlModel.Step = INVISIBLESTEP)
End Function
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|