Fernand Vanrie wrote:
Johannes Öberg wrote:
Ah, the beauty of Basic! :-)

Thanks!
/J

2010/4/29 Bernard Marcelly <marce...@club-internet.fr>

Hi Johannes,

Message de Johannes Öberg  date 2010-04-29 15:11 :

How can I set the BackgroundColor of a label to transparent from a macro?
When I Xray BackgroundColor after setting it to "Default" from the Form designer, it says it is of type Empty. Should i remove the property? How
do
I do that?

Sorry if this is a stupid question again; I have googled for over 1h and
not
found an answer.


No so stupid...
You should have specified if the label is in a form or in a dialog, things
may be different.
This solution _nearly_ works. I tested it for a label in a form.

' *** Basic ***
'   k is the model of the control
Dim nocolor As Variant
k.BackgroundColor = nocolor

The trick is that a declared Variant is initialized as : empty !
Well, it _nearly_ works because the page of the document is not repainted. You have to change the page and return, or at least set the control out of
the displayed zone.
Someone else will find out how to trigger repaint...
for a dialog:

       oWin =GetWindowOpen("DialogTitlename")
       oWin.invalidate(1)
oeps: forgot thge function made by Andrew Pitonyak
function GetWindowOpen(sTitle as String) as Object
oToolkit = Stardesktop.ActiveFrame.ContainerWindow.Toolkit
lCount = oToolkit.TopWindowCount

for k=0 to lCount -1
 oWin = oToolkit.getTopWindow(k)
 if HasUnoInterfaces(oWin, "com.sun.star.awt.XDialog") then
   if left(oWin.Title, len(sTitle)) = sTitle then
     GetWindowOpen = oWin
     exit function
     endif
   endif
 next k
end function

if a Form then you can trye

dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(ThisComponent.CurrentController.Frame, ".uno:UpdateAll", "", 0, Array())

hope it helps

Fernand


Regards
 Bernard




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





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


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

Reply via email to