I don't see the key events in the public events for the label, but I really need those.
Is it possible to do it?
Printable View
I don't see the key events in the public events for the label, but I really need those.
Is it possible to do it?
Yes , you could inherit the Label class and add that event .
Extending the label class? sorry i'm kinda newbie. :ehh:
thx
Then read up about events and delegates . Google it
I have, but what I've found is about custom events, involving data and other stuff (I read the examples in .net framework doc etc -- the alarm etc) but it never mentions how to add an "existing event" to a existing control.
Thats what I got a bit unclear.
Like "key up" & "key down"? Wouldn't the control have to have focus in order to detect that.
Extending the existing Label class ,I think, won't work . You probably need to build custom control . It doesn't derive from or combine existing controls. It's a lot of hassle since you have to implement all the other events,methods,and properties .The base class that you would work with is Control which I guess has the Keyboard events .
Yeah its a lot of work... I think the best solution is to save which label was "clicked/selected" last and then make one big event handler to process the key events for all the controls in my form, then fire up whatever I wan't to do.
Speaking of which, where can I see which controls get focused by default? (i.e when you click on it or select it using tab -- does most controls work that way?)
If thats the case, is it possible to "propagate" the key event to its parent form?
You see, I need to make kinda like a modal row of labels, it needs to work kinda like a tabbed window, where a tab always need to be selected, meaning that the key events (shortcuts) are in fact global -- like in a menu, so focus isn't important.
Anyways this is certanly not the practical solution but it can work ok with "less thinking"
If anyone has a better idea please let me know.
thanks for your help.