UltraPopupControlContainer takes away the focus from the form. Is there a way to make it behave like the popup of a combo-box?
Hi,
UltraPopupControlContainer does not take focus, but the control you are assigning to it may. What control are you using? I think you would have to create a control which does not allow itself to get focus in order to achieve what you want here.
It contains a UserControl.
I tried this out and I guess I am a little confused by what you mean by "Accepts focus". I assumed you meant that you didn't want the control to take focus automatically when it is dropped down.
I created a UserControl with a TextBox on it and I put a breakpoint in the Enter event of the UserControl and the TextBox and neither of these get hit when I drop it down.
So are you trying to prevent the UserControl from taking focus when the user clicks on something within the UserControl? The PopupControlContainer has no control over this. You would have to create your UserControl in such a way that nothing on it takes focus.
Sorry for the confusion, I mean the window/form itself is losing the focus once the popup control is shown and receives focus.
Okay, but that doesn't change the answer. :)
If a control on your UserControl is taking focus, then the form will lose the focus. There's nothing the PopupControlContainer can do about this. You would have to create a UserControl that does not take the focus.
So if there is an UltraTextEditor inside the UserControl, the parent window will lose the focus? Is there an AllowFocus property for UltraTextEditor?
Thanks Mike. Always nice to get an answer that makes perfect sense.
There really isn't anything we can do about this. A dropdown cannot be displayed as a "true child window" of the form, because if it were a child window, it's display would be limited to the bounds of the form it was on. But the dropdown needs to be able to go outside of those bounds. So it is displayed as a top-level window.
If any control within that window takes input focus, then the form it is on gets activated.
The way that we deal with this in our controls is the control in the dropdown doesn’t take focus and it also overrides the WndProc to handle the WM_MOUSEACTIVATE and return MA_NOACTIVATE. So you could create your own control for the dropdown and do the same thing.
I'm having the same issue. When I load a UltraPopupControlContainer within my application the control container will remove the "Active Window Status" away from the main application's title bar. When this occurs, the user is left asking "what application is Active now?".
If the control container is acting like a simple control (without a title bar) that hosts other controls, then it should not take Active Window status away from the main parent like a dialog will. Yes, focus is set elsewhere but that has nothing to do with the true undesirable behavior the control container is exhibiting.
So, is there a way to tell the control container to behave itself and act like a true Child Window rather than a Form/Dialog?
No, I don't beleive so. UltraTextEditor has to take focus in order to function. There's no way around that.