Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Make usercontrol that doesn't steal focus

Make usercontrol that doesn't steal focus

Scheduled Pinned Locked Moved Visual Basic
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TwoFaced
    wrote on last edited by
    #1

    I've made a simple user control that has two properties and 3 different states. I'd like to prevent this control from accepting focus. Basically I want it to act like a label or panel. I've tried overriding wndproc, but haven't had any luck. All research has also turned up nothing. Any help would be appreciated.

    C 1 Reply Last reply
    0
    • T TwoFaced

      I've made a simple user control that has two properties and 3 different states. I'd like to prevent this control from accepting focus. Basically I want it to act like a label or panel. I've tried overriding wndproc, but haven't had any luck. All research has also turned up nothing. Any help would be appreciated.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      If the label class does what you want, why not just derive from that ?

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      T 1 Reply Last reply
      0
      • C Christian Graus

        If the label class does what you want, why not just derive from that ?

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        T Offline
        T Offline
        TwoFaced
        wrote on last edited by
        #3

        I suppose because I'm stubborn :) Actually, I hadn't thought of that. In my fiddling I stumbled across a different solution. It seems a UserControl inherits from UserControl and a custom control inherits from Control. A UserControl will recieve focus when clicked, but a Custom control won't. I'm assuming Usercontrol inherits a class that handles the focusing, which is why that type of control will always focus. I tried researching what the differences could be but came up empty handed. So now I know in a situation like mine just inherit from control if I don't want it to get focus. I've discovered another mystery in my pointless pursuit of information. How come the TabStop property doesn't exist for labels? TabStop is a property in the Control class and a Label is a control. How could it not be there? Oh, well. Unless somebody knows, I give up. I've figured out what I needed to know. Thanks for your reply.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups