|
-
Jun 3rd, 2008, 09:19 PM
#1
Thread Starter
Hyperactive Member
[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.
-
Jun 3rd, 2008, 10:22 PM
#2
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.
-
Jun 3rd, 2008, 10:30 PM
#3
Thread Starter
Hyperactive Member
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.
-
Jun 3rd, 2008, 10:59 PM
#4
Re: [2.0] MouseEnter with Groupboxes
 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|