|
-
Jun 15th, 2002, 04:02 PM
#1
Thread Starter
Addicted Member
ActiveX Focus problem
I am designing an ActiveX control which is a control container that can get focus, however, I can't figure out how to keep the focus on the control when one of it's contained controls recieves focus. In fact, it doesn't need to have focus really, but I want it to visually look like it does as long as it's child controls has the focus. So maybe, if there's some way to check if the control that currently has focus is contained in my control.
Any help would be greatly appreciated.
-
Jun 15th, 2002, 04:07 PM
#2
Have you tried using the Enter/ExitFocus events of your control?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jun 16th, 2002, 08:10 PM
#3
Thread Starter
Addicted Member
Yeah, I've tried those. Both the ExitFocus and LostFocus are called when focus is taken from my control, even when one of the controls it contains is given focus, so there is no way to differentiate between controls that are contained by my control and controls that are outside of it.
-
Jun 16th, 2002, 08:26 PM
#4
Addicted Member
So, users will add controls into your control, is that right?
-
Jun 16th, 2002, 11:22 PM
#5
Thread Starter
Addicted Member
yes.
To be more specific, it's similar to the standar frame control, only it's a type of bevel that has a titlebar style where when that frame (or one of the controls therin) has focus, the title bar shows an "Active" color, otherwise it shows the "Inactive" color.
-
Jun 16th, 2002, 11:49 PM
#6
Try this...When the ExitFocus or LostFocus event is fired, loop through the UserControl.ContainedControls collection to see if the active control is in your group. If it is, retain the "focus" look. If not, switch to the "unfocus" look.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jun 17th, 2002, 05:34 PM
#7
Thread Starter
Addicted Member
Yeah, that's actually where I've left off... stumped. I know how to loop through all the UserControl.ContainedControls, but, I don't know how to check if it has focus. (ie UserControl.ContainedControls(x).SomeMethodToCheckFocus. Perhaps an API of some sort? I'm don't want to access a property or method that only some controls have.
Thanks for all your help by the way.
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
|