I'm making a Windows Form as seen below. When I click on a row in the DataGridView, the details of a person is transferred unto the TextBoxes at the side. When the user click the Edit button,the entire Panel to the right becomes editable; the TextBoxes and CheckBoxes are Enabled and allows the users to edit a person's name, birthday, etc. After which, the changes are saved to the database.
I don't want the user to click a different row while editing and thus want to detect when a user leaves the Panel so I can prompt him/her.
How do I detect if I've lost focus of the Panel?
If I'm going about this wrong, please respond with the appropriate answer instead.
Perhaps when the user begins editing a record in the Panel you could set the Enabled property of the DataGridView to False, and when a Save button is pressed you can set the Enabled property to True again.
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 am working on implementing a WPF Datagrid and I have a requirement where a record in the grid must always be selected. I have set the SelectionMode=Single and SelectionUnit=FullRow. However if i click and drag a given record while pressing control i am able to enter a state where the grid no longer has a selected value. It looks like by pressing control i am able to get the record to deselect. I have tried handling the preview key down event and setting handled to true when the control key is pressed but it seems to be an order of operations issue between click/dragging the records and the control key being pressed. Ultimately i would like to just disable the whole click/drag the grid selection, but i am coming up short on that one. I am trying to keep this as clean as possible. Does anyone have any experience with this?
I developed a windows application. The input screen has two date pickers followed by a set of textbox as input fields.
After checking on the Dates
When I click on Tab Control, Cursor is not transferred for next input, it goes to submit button
What settings should i specify to transfer control sequentially across the input text boxes before finally hitting submit button
Thanks in Advance for the help
Set the TabIndex property of each control.
To help with that, you can click the Tab Order button in the WinForms designer toolbar, then click the controls in your desired order to set their TabIndicies.
UI is created in VS 2008. I'm using C# .... I need to let the user move/focus between text fields from top to bottom by clicking tab button. How can i do it?
On the Layout toolbar (will normally show up if you're in Design View) click on the buttom on the most right (it's called tab order).
Now on every element on your designer will come up a little box with a number. Just click all your elements in the order you like and they will automatically be re-ordered.
If you like to do it manually, just take ho1 advice and change the property manually.
You just set up the TabIndex property properly, so that it's sequential from top to bottom. Then it'll work automatically and you won't need any code to move around the focus.
So in other words, set the top TextBox TabIndex to 1, the next one you set to 2 etc and then one at the bottom will have the highest number (of the textboxes, you probably want to have even higher indexes for any OK buttons and similar so that the user can jump to them after editing all the textboxes).
You can find more info about it here:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.tabindex.aspx
I'm developing an ASP.NET web application with AJAX.
I have a page where the user can edit some information: it has a list of item, the user select one item, click on Edit button and then edit item's name and item's description on two textboxes.
If user click on another item since he doesn't save his changes, he can click on edit button to edit this new item.
I want to check if there is some data on textboxes and ask to the user if he wants to lose their changes before loading the data of the new item.
How can I do that?
Thank you.
There are four ways that I can think of to handle this:
Always save the changes (auto save). We've eliminated almost all save buttons from forms and just always auto save the data based on user feedback.
Always prompt to save changes; i.e. assume that if the form is in edit mode then there are changes.
Hook every control's change event and toggle a boolean if any control fires its change event; prompt the user if it's true.
The hardest (and arguably best) method is to actually compare the previous values to the current values and only prompt if they're different.
The method you select depends on the application and user expectations.