Blinking label

In a desktop application I have a label, background = Transparant, on top of a colored rectangle.
The text of the label is not static but from the database and to get extra attention this text needs to blink.

Label1.Visible = label1.Visible xor true

Quite simple. On OS X this works fine, no issue, on Windows the user sees an annoying repainting of the label, getting to transparant at the very last moment of the painting.
I tried to set / clear the .text property instead of the .visible, but it’s the same.
Since the label-control has no property to set the ‘background-color’ the same colored background, it seems I cannot solve that quite easy. So I am looking for a trick to solve this issue and hope someone has can hint me.

I do not see the repainting here, but it is possible it happens on a slower machine.

What about using a canvas ?

Where and how often are you calling this “blink” code?

BTW, you can toggle a boolean with a simple b = not b.

[code]const normalpos = 200

if label1.left = normalpos then
label1.left = -500
else
label1.left = normalpos
end if[/code]

O, of course… Thanks Kem.

700 ms visible 300 ms invisible

@Jeff Tullin : the trick you mentioned above looks logical but doesn’t solve the problem. (Windows)

I tried, but the thing is that I have a string as a result of a select query and that brings me to using a label again.

You could try changing the color of the text instead of using Visible.

if label1.TextColor =&c00000000 then Label1.TextColor = Rectangle1.FillColor else label1.TextColor =&c00000000 end if

I agree with Michel. Use a Canvas. Layering controls like this is generally a bad idea and leads to severe flickering if the window is moved or resized.

Tested … doesn’t work satisfactory either. Worse than using the .visible property.
Going to setup blinking label within a canvas and will post result here.

Having a complex GUI it’s obvious to work with containercontrols within containercontrols etc. Don’t know how to do rapid GUI development without this technique. So far it works for me, except using the Groupbox control, shapes etc. , which results in flickering with MS Windows.

Do you have the window set to double buffer?

Maybe you can freeze redrawing with a WM_SETREDRAW message, and force all the drawing to happen at once?
(This is what invalidate is supposed to do really, you set invalidate on things that need repainting and Windows will do it when it gets around to it)

[quote]In a desktop application I have a label, background = Transparant, on top of a colored rectangle.
The text of the label is not static but from the database and to get extra attention this text needs to blink.[/quote]

How about changing the label for a simple .drawstring call in the paint event?

Thanks to all for your suggestions.
I used a canvas holding the blinking label and that works perfectly fine.