Best way to make LABEL's clickable in CF 1.0?

Hi,

There's no working Label.Click() event in CF 1.0 at this time. I can't use read-only textbox in this situation, because I need to use a label appearance rather than a textbox appearance.

What is the best workaround to make a label clickable in CF 1.0? I have multiple Label's inside a Panel control, each of which requires a separate click event.

[358 byte] By [MarkRejhon] at [2007-12-16]
# 1

Writing your own control for this basic functionality is pretty simple (and the answer to your question).

For an example of a LinkLabel (cutting it down for your own needs should be straightforward), see here:
http://vault.netcf.tv/VaultService/VaultWeb/Blame.aspx?repid=2&path=%24%2fSDF%2fOpenNETCF.Windows.Forms%2fLinkLabel.cs&version=2&includedversions=20
(guest, guest)

Cheers
Daniel

DanielMoth at 2007-9-9 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 2
Would it be even easier to essentially inherit the Label control somehow, and add click functionality? Or will I have to write the whole control itself?

I'm deciding on which route is easiest. I just need something identical to Label, except with a click event, that can be easily be used as a drop-in replacement for Label.

MarkRejhon at 2007-9-9 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 3
Sorry no.

How would you offer the Click event in your new control? Either you have to expose the existing Click event (which we established isn't supported) or handle MouseDown/Up and create your own Click event, but they are not supported either; so you have to roll your own control if you really need this functionality. Check out the article I linked, it actually isn't that much work.

Cheers
Daniel

DanielMoth at 2007-9-9 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 4
I did. I'll take a serious look at it.

The reason I am doing this is that checkboxes do not support wordwrapped text, so I am using a Label next to a CheckBox, but I lose the functionality of being able to click on the text to toggle the checkbox on and off.

MarkRejhon at 2007-9-9 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 5

Hi,

i′ve a similar issue concerning the need of "clickable" labels with CF. I′ve tried you link, but it doesn′t work. Is there any other source where i can get the info mentioned above ?

Thanks in advance
Klaus

KlausLeithner at 2007-9-9 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 6
How about this one:

http://www.intelliprog.com/articles/index.html

AlexY at 2007-9-9 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...