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...
Related
I have a simple ToolStrip with buttons in it which contain images and text. When I go over that button it changes appearance (same when it gets clicked). How can I customize this so that it stays highlighted when clicked? I have to do this over a tabControl so that it stays highlighted when the tab is entered and gets back to its normal appearance when leaving the tab. Which methods do I have to override?
Thank you!
just set ToolStripButton.CheckOnClick property to true from design time. So it will stay highlited when clicked.
About the other requirement set ToolStripButton.Checked to true on entring the tab control, and set it to false on leaving the tab control.
For entering and leaving you may use Control.Leave & Control.Enter events of tabpage/tabcontrol.
Let me know incase of any issues
I have a C# user control.
In this control, I have a GroupBox that includes radio buttons and textboxes.
When the user switches between the radio buttons, a message box is raised to ask the user if he is sure in his selection.
The top of the messagebox is covering the last radio button and the last textbox.
In a case the user selects NOT to apply the radio button changes, the messagebox is getting closed, but the last radio button (that was covered by the messagebox) disappered. (The last textbox that was also covered by the messagebox is not getting disappered).
This is kind of refresh problem, because when I move the mouse button on the place of the last radio button, it appears again and everything is fine. (it appears again also if I minimize and maximize my application, etc).
I tried to run the methods Show() and Refresh() on the last radio button after closing of the messagebox, but it doesn't work.
What else can I do?
Thanks
Try Application.DoEvents() after the MessageBox closes to ensure there are no other processes in the processing queue. This should re-show the button but it is difficult to tell if you do not show any code as there could be other issues.
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.
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.
Avoid the closing of Menu in the ToolStripCombobox in the Windows application. when i select the items of the combo by using the UP/Down arrow keys the dropdown menu is closed automatically whenever the selection changed. How to avoid that auto closing?
I cannot reproduce this.
I created a form, added a ToolStrip control to it with some standard items, and then added a ToolStripComboBox to the end. Finally, I added a few items to the combo box for testing purposes.
When I run the application, and toggle the selected item in the combo box using the up/down arrow keys, the combo box does not close automatically. I can move the selection up and down the items in the combo box without ever triggering it to close until I press the Enter key.
What are we doing differently? Please update your question to explain the steps necessary to reproduce the behavior that you describe.