After you click outside the drop down, it seems the focus is still on the drop down; scrolling, you select (without knowing) another value.
I want to lose the focus while clicking on the tab control or any location of the page.
As Otiel commented, click outside ComboBox won't make it lose the focus.
You can handle the Click event for the container (eg. a Panel) of your ComboBox and set the Focus to other control by using Control.Focus Method.
Related
I have prepared one dropdown user control with a searching feature using textbox, panel, and checked listview.
when I click on down arrow PictureBox or in the displayed textbox, the listview panel will open as dropdown, and based on the mouse click I hiding and showing checked listview panel.
Now, when I put my user control within any panel and an open dropdown that time my user control's listview panel is going backside of the parent control/panel as I shown in the screen.
Please Help me.
I have a user controls on winforms that contains a toolbar, the problem is whenever the application loses focus then i have to click the toolbar button twice to trigger the click event. I know this is because the first click is for the application to have the focus then then second click will be the actual click event. This only happens to toolbar control but not on other winforms controls.
I got tiered finding the right solution to solve this with ToolStrip control, what I did was I just changed it to Button control set its to Flatstyle then added some mouse hover to mimic the ToolStrip.
I have an "On screen keypad" with some up/down/left/right/select buttons.
The select button is effectively a click and the arrow keys fire the associated up/down/left/right key.
The problem is that when selecting a combo box, I can't press the down/up buttons to navigate the items in the list. It is because the combo box auto closes when loosing focus. I can see similar problems happening with other controls, so I would like to see if there is a way to do the following.
For certain buttons (up/down/etc), when clicked, fire the click event, but don't take focus from w/e currently has the focus. This would allow the combox dropdown to stay open while pressing up/down to navigate through the items.
I have tried to set Focusable=False on the navigation buttons but the focus is still taken away from the combo box and the dropdown closes.
Any ideas/suggestions?
Thanks in advance
This isn't happening because of anything your Buttons are doing so changing their focus state won't make any difference. ComboBoxes close when you click anywhere outside of them, including empty space, non-interactive controls, other windows...
I am trying to replicate an intellisense like feature where you have a textbox and a menu that's shown below it. I know intellisense doesn't use ContextMenuStrip, but my version has to have categories which are sub-menu items.
So as soon as the user clicks into my TextBox, I bring up the menu below once, but then even though I can see the caret in my TextBox it doesn't receive any key inputs. I have to click inside the TextBox again but that removes the menu from the screen.
Is there a way to prevent this? Or perhaps make the menu persistent on the screen without stealing focus?
ToolStrip control with items added to it seems to work since it's always on the form.
I have a textbox in a windows form. Currently the focus is on the textbox and i enter some text. Now I click outside the textbox but within the window. This action does not make the text box to lose the focus. The cursor still blinks in the text box. If the click was on another control then the text box would lose the control.
How would I make the text box to lose control when clicked outside of it (not just on another control but anywhere inside the form)?
Thanks in advance.
Datte
Because you click on a control that has no ability of taking the focus (like a form, a label, etc). If you click for instance on another text box the focus should move..
To move the focus programmatically (i.e. in the OnClick event of the Form) use the control.Focus method.