Results 1 to 8 of 8

Thread: making a label control accept focus?

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    making a label control accept focus?

    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)
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    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.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    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
    any ideas?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    How about textbox and changing some background and drawing stuff to mimic a label look .

  5. #5

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    hmm I want to do it with the label control
    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???
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  6. #6
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    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.

  7. #7

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by salvelinus
    you'd have to override that behavior somehow.
    that was my question actually



    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
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  8. #8
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width