A more complex widget, such as this one, will contain additional scripts for complex operations and, of course, all the cool graphics that make it pretty. Any changes we make in that area, will reflect in these files. They contain the general layout of the widget as defined in the GUI section of Dashcode. These are really all that are necessary for your basic widget. They include an web document (html), a style sheet (css) and a script (js). Notice the files with the same name as our widget, "Unit Converter +". This will open a new devision in the window showing us the files that make up this widget. Under the 'View' menu icon, select the 'Files' option. Just try to understand how the program does what it does. Also take note of the other support files and what they contain. Examine how the various JavaScript (js) files interact. Take your time and examine everything in the Widget. Before we start messing with the code, it's a good idea to try to understand what we're messing with. Never (And I mean NEVER!) work with the original. What we now have before us is an exact duplicate of Apple's original Unit Converter Widget with a new name. Well, let's see if the Unit Converter can answer that. I'm confronted frequently by people that just can't understand why that 10GB Hard drive they just purchased has less than 9.5GB. Now, where it's lacking, is that it doesn't do Numeric conversions. Just accept the exact results and do your own rounding as needed. With any rounding, you'd end up with screwed up results. Yea, it could have rounded this to 252 calories, but that would end up corrupting the data if you chose to then convert those Calories to Joules and then back to BTUs. You're immediately told that it's 251.99576 calories. Ever wonder how many BTUs (British Thermal Units) make up a Calorie? Just pull up the Unit Converter, select the Energy catagory, the BTU and Calories sub-catagories and enter '1' into the BTU area. It makes just about any conversion from and to related units. In the case of the Unit Converter, what it does, it does beautifully. It's a mater of understanding what the Widget does and then add to that. Customizing a Mac OS X Widget might seem a daunting task.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |