It sure must be possible because LinkLabel inherits from the label control and it can accept focus. Does anyone know how to make the label control accept focus? (I'm trying to make my own control my inheriting from the label control)
Printable View
It sure must be possible because LinkLabel inherits from the label control and it can accept focus. Does anyone know how to make the label control accept focus? (I'm trying to make my own control my inheriting from the label control)
Hi,
Surely an inherited control can have additional properties from the base control?
If this cannot be done you have the alternative of inheriting from the LinkLabel control instead.
eeh ok, the label control doesnt get the focus... if I can just get the onGotFocus event of label to fire somehow... There is a CanFocus property and I overrode that to always return true, still doesnt help:D
any ideas?
How about textbox and changing some background and drawing stuff to mimic a label look .
hmm I want to do it with the label control:D:D:D:D
I can draw the focus lines when the label.focus() is called manually, no big deal. But I cant figure out how the focus is passed among the controls. I dont think the label control can capture the tab key that's pressed on the form to pass the focus around. I overrided the WndProc function. It seems like whenever the label is losing focus the m.Msg in WndProc is = 8... but I don't know if this has anything to do with WndProc... I thought maybe that'd let me mess around with something and get it to work, but I dont know what I'm doing
hmm so when the user presses the tab key on the form, does the form itself call the Control.focus() event to make a control have a focus? if so why wouldn't it call it for my label control???
In VB6 if a label was given focus, it automatically sent the focus to the next item in the tab order. If .Net does that, you'd have to override that behavior somehow.
that was my question actually :)Quote:
Originally posted by salvelinus
you'd have to override that behavior somehow.
I can KEEP the focus there when you call myLabel.focus()... but sitll on a form when I press the tab key it wont get the focus
I'd think that you'd have to know what code in the base label is responsible for that behavior to override it (going on old C++/Java work, haven't done it in VB). I don't know if MS exposes it, or if it's overridable. I think the label does get the focus, just doesn't keep it.
You could set some kind of flag, and when it jumps to the next taborder control, set it back one, if label.focus works like you say.