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.


Answer this question

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

  • MetaDjinn

    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


  • RAnderson14

    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.


  • totof42

    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



  • Graham Hay

    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.

  • HuyN_MS

    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


  • Senthil84

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