Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com�s entire library of video tutorials.
Now that we can view a task by double clicking on it, or clicking the edit task button, or using the menu, let's update things so that when we make changes to the task, those changes are reflected in the class and back in the ToDo list itself. Let's go back to the task edit window, and let's add a new property. We'll call this cancelled and this will be used for the ToDo list to tell if the user clicked Cancel on the task edit window. And we can go back to here and when they click the Cancel button, we set cancel equal to true. When they click the Action button we will set cancel equal to false and we will also close the window. We also need a new method called update task. This method will take the fields from the window and assign their values to the class. Here we take each of the fields and assign them to the appropriate properties on the task itself. For the due date we require it to be entered in sequel date format. This is for simplicity. In a future video we will look at using a plugin to make this easier. (Unintelligible) at the end we call the save method on the edit task. Although this is not implemented when we do get to implementing it, this will actually persist the changes directly to the database. Let's go back to our action button clicked, and call update task. Now we can go back to the ToDo window. In our edit task method we set the task for the window, and then we show the window. Now we need to check if we should apply the changes. So if they do not click cancel, we call our new update task row method, which will update the row with the new information, so let's create that method now. We'll set the completed check value, display the due date, and lastly display the priority and category. Now let's run the application. Let's add some new text here, we'll put in a due date, and click OK. You can see everything's saved, the update is now visible in the ToDo list. We did get a message about an error. That is related if we go back to the appropriate method to calling our saved method on the task, which we have not yet implemented. If we check that method, we will see that we're not returning a value, so that means it's always going to return false. So let's tell it to always return true, until we actually implement it. You'll notice changes were not persisted because we have not implemented the save method. One more change we want to make in the update task method is regarding the date. It's very possible that the user could enter an invalid date. We should attempt to catch that. When that happens we will simply just blank out the due date. Let's run our application again. You'll see this exception was triggered, we will resume, and everything was updated correctly.
| Course: | Real Studio |
| Author: | Paul Lefebvre |
| SKU: | 34190 |
| ISBN: | 1-936334-77-1 |
| Release Date: | 2011-02-02 |
| Duration: | 7 hrs / 87 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |