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.
Related
This is a concept question. I have a web form with 6 gridviews, below each gridview is a textbox. Each row of the gridview contains a question and 5 radio buttons. When a radio button is ticked or text is entered in the textbox it updates the database immediately with one caveat, the textbox is committed when the user presses the tab key, or refocuses curser outside the textbox, or clicks an unrelated button (basically when a postback or textchanged() event occurs).
The problem: There is a delay during postback when the text is committed to the database causing the user to think they can move to the next textbox only to have the curser return to the previous textbox. I added code to prevent the curser jumping but the delay is still an annoyance to users during testing. I added a confirmation message (label) to alert the user when it's ok to move on but when the confirmation message disappears at the next postback, usually when the user ticks the next radio button, the gridview shifts up and the user's curser is pointed to a different line of the grid. This is also annoying users.
Solutions? In my limited experience I have 2 alternatives maybe 3 (below). The reason I did not do either was because I wanted data to update the database as soon as it was typed or ticked. Since the radio buttons cause an immediate update I didn't want the users to inadvertently think the textboxes did too and forget to click a button to commit the text. Since entering text in the textboxes is optional, I don't have a way to validate if the user is done completing the form and remind them to click a button to commit their text input.
Put a button by each textbox to commit the text
Use one button to commit all textbox data when form is complete
Find a way to put a placeholder where the confirmation label is when its hidden so it doesn't shift on postback.
I'm starting to think one Submit button is the way to go and let the user think that is what saves the data? Simple.
At any rate is there a better way to achieve my goals of having input updated in database immediately without annoying delays (postbacks) and grid shifting at inopportune times?
In my case I changed the textbox AutoPostBack property to False and removed all code in the text_changed() event for all textboxes. I am committing the text when a Submit button is clicked. (The radio buttons still commit to db immediately when selected). In the end, I think users are conditioned to click a submit or save button when they finish filling out a form anyway.
i've been searching on internet for the property that says that a normal button was selected or not, i think there must be one because when you click a button, it turns light blue, regardless the mouse is over it or not, and when you click another button, the previous button changes back to normal and the new clicked button is set light blue.
I need it to know which button was just selected and draw a "resizing" square on it, and it gotta last as long as the button remains as the "selected one".
thanks in advance.
What you are looking for is the Focused property. For actually any Control it returns, whether it has input focus or not (so e.g. hitting Enter will cause the button to be clicked as well). Since it sounds like you want to be notified whenever that property changes, you should use the GotFocus and LostFocus events.
You can give a Control focus programmatically by calling Focus.
you can do two things,
you can do it with the events: mouseEnter and MouseLeave,
this events launches when the mouse enters or leaves the visible control area,
also the focused(boolean) property gets and sets the "selected" element
one solution could be to:
private void onElementMousenter(blablabla,sender e);
{
e.Focused=true;
}
and assign the mouseEnter events in all controls to this one so the last element will be the "selected one" until you select another
I have a text box on a Gridview which I'm allowing some data to be edited. When the enter key is hit, the TextChanged event happens, like I'd expect. But when i change the data and click a button, the button effect not happen. I must click the button again to fire button event. I think it happen because the grid didnot lost it focus.
How to make it possible fire the button event just in one click?
You can change your gridview element's IsTabStop property to false to gain that effect.
Also if you want to cycle with Tab you can TabNavigation="Cycle" .
Both changes are in xaml.
Not much we can do to help you here without the code itself but here are couple things you could try to debug this:
Try different browsers – it may be a browser issue
Try some client side debugging – just open console and see if anything happens when you click the button for the first time
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...
The problem like this, I have a groupBox which contains two radio buttons, when I run the form, the first radio button get checked immediately, so I tried the following:
Set the check property for this radio button to false in Load form.
Set the check property for this radio button to false in the form constructor.
Change the tab index property for this radio button, the selection moved to the next radio button in the form.
None of the above worked with me, any suggestions??
You could try setting it to false in the form SHOWN event instead of the form LOAD event as outlined in this question.
As soon as any of the radio buttons get focus it'll be selected, so you need to set initial focus in the form to another control than any of those radio buttons (worst case I suppose you could have a hidden radio button or other control and give that focus, but I'd not recommend it since it looks funny).
The intent of a radio button set is to provide choice between a set of distinctive and exhaustive values.
That means, that at all times, one and only one radio button should be selected.
If this functionality does not suite your application logic, maybe the logic is flawed, or maybe radio-buttons are not the best UI solution.
As mentioned, a radio button group displays its behavior as soon as any of the radios get focus, which can happen even with just tabbing around the form, so basically the behaviour of the form depends on the user behaving nicely.