Results 1 to 4 of 4

Thread: [2.0] MouseEnter with Groupboxes

  1. #1

    Thread Starter
    Hyperactive Member Quasar6's Avatar
    Join Date
    Mar 2008
    Location
    Sol 3
    Posts
    325

    [2.0] MouseEnter with Groupboxes

    I was planning on deactivating some controls when the curser enters a group box, and reactivating them when it leaves that groupbox, to indicate to the user that those controls aren't relevant when using the buttons inside that groupbox.

    I was planning on using MouseEnter and Mouse leave to accomplish this.

    But I've just discovered that groupbox's don't have MouseEnter and MouseLeave events in their event list in the designer.

    I am wondering why. The intellisense seems to give me these events, but this means I have to define it for myself during form1_load.

    Anyone know?

    Thanks,
    Qu.
    "Why do all my attempts at science end with me getting punched by batman?" xkcd.

    |Pong||
    Sorry for not posting more often.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] MouseEnter with Groupboxes

    Think outside the square. Add a Panel to your GroupBox and the child controls to the Panel, then handle the Panel's events. Just note that, if I'm not mistaken, when the mouse pointer enters a child control on the Panel it will raise the Panel's MouseLeave event.

    That said, I can't really see why you would want to do this anyway. Why would a control's Enabled property depend on where the mouse pointer is? If a control can't be used then it should be disabled, plain and simple. I'd be interested in the rationale behind this design.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member Quasar6's Avatar
    Join Date
    Mar 2008
    Location
    Sol 3
    Posts
    325

    Re: [2.0] MouseEnter with Groupboxes

    Thanks for the reply.

    My form has an "add" button at the bottom, which would take the data from all the controls and give it to an external program. The buttons in my special groupbox do the same thing, but they only use the information from two of the controls.

    The enable/disable was meant to be a visual cue to indicate that only the information in those two controls would be used, and would work by disabling (and thus greying out) all the other controls.

    And you're right: entering the buttons will raise the MouseLeave event, which doesn't accomplish what I need.
    Last edited by Quasar6; Jun 3rd, 2008 at 10:36 PM.
    "Why do all my attempts at science end with me getting punched by batman?" xkcd.

    |Pong||
    Sorry for not posting more often.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] MouseEnter with Groupboxes

    Quote Originally Posted by Quasar6
    And you're right: entering the buttons will raise the MouseLeave event, which doesn't accomplish what I need.
    So handle their events too.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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