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 we're going to Build a Preferences Window, let's Add a new Window to the project and it will be our Preferences Window, we will make it Movable Modal and Not Resizable and let's set up a few things here, give it a Title, shrink it a little bit. The two Preferences we're going to want to Add are a Setting for when Alerts should appear and a Setting for whether we should use the Alternate Row Highlighting that we implemented earlier, so let's Add these. Next we need to Add and use our OK Cancel Control to Close the Window, we'll lock this to the right and the bottom so that we can resize the Window and have it move with us. We've Added the Code to Close the Preferences Window, so this is what our Preferences Window will look like, now let's hook it up so that we can actually open it to test it out, we'll go back to the Todo Window and we'll Add a new Menu Handler. Let's find our Preferences Menu. Now let's test this, Preferences should now be in the Main Menu of the application and here it is. We did not add anything to the drop-down, we can click this button and we can click cancel. Now in order to Save our Preferences we should Create a Class to actually contain the Settings, let's Create a New Folder and actually we're going to use a Module for the Preferences because we only need one for the entire project. We'll Add two Properties, one for each of our Preferences, we will leave it at the Protected setting, this little yellow triangle and this will allow us to reference the Alert Minutes Property by typing Preferences.AlertMinutes anywhere in the project, let's also add and this is a Boolean, and we should probably put Default Value so let's Set that to a Default of True and Alert Minutes to a Default of 15. Now let's go back to the Preferences Window, first we want to populate this drop-down with some default values, we'll go to the Open Event of the Popup to do that and we're using the Open Event because we want to write code because we're going to Set the row Tag to be the Value that we're actually going to persist in our Preference Property. So we'll set a few times here. Now let's Run our Project again so we can see these Values, they are all now here. Now let's look at the Properties of the Preferences Module and Set these to match them. So in the Open Event of our Preferences Window we will Set, uhhh let's get the name of this guy right here Alternate Row Highlight Check, let's Set whether this is Checked based on the Preferences. Now let's test this and you'll see that it's now checked. Conversely we can Add Code to our Action Button Clicked and say Preferences. Now the state of that Checkbox will be remembered if we click OK, so let's uncheck it and click OK and when we go back it remains unchecked. Notice the Window's not closing when we click OK because we did not tell it to, so let's go back and Add that.
| 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 |