November 15, 2002   Tip of the Week Mailing List
The Tip

I like to make a habit of creating my variables with an initial value. When I first started using lists, it drove me up the wall that sometimes my list variables simply would not store the information I was trying to put into them. The reason for this is that, in most cases, linear lists must be set to "[]" (no quotes), and property lists must be set to "[:]", before they will store list information.

Now, I make sure that when I create a variable that I want to use as a list, I type in "[]" or "[:]" as its initial value, depending on the type of list it is supposed to be. I also make sure to enter a description of each variable as it is created. Sometimes I click through a little too fast, and so the Initial Value and Description for a new variable will be left at the default. This is easy to change in those fields in the Variables window.

Another type of variable I like to set an initial value for is icon variables. Sometimes I want to create a Display Icon that usually will appear right where I positioned it on screen, but I also want the optional ability to position it with a variable..

To handle this situation, I create icon-level variables, such as PosX@"my icon" and PosY@"my Icon". I use these in the InitialX and InitialY fields in the Icon's Layout tab, making sure to write down what the original values were.

When I close the Icon Properties Dialogue for the icon, Authorware will prompt me to create those icon variables. I set their initial values to the InitialX and InitialY that were originally in the fields. This creates an icon that can be variably positioned, but unless I change those variables, it is positioned exactly where I first dragged it.

A nice side benefit is that if I change these variables to display the icon at a new position, I can change them back with the Initialize() function. 

Did you know?
Icon-level variables do not show up in the variables window unless you have the Icon selected, and you have selected the category @"that particular icon" from the Categrory drop down. A lot of Knowledge Object developers use this fact to make their code harder to figure out or change.

 
Addendum to Tip

A couple of weeks ago, I posted a Tip about how to paste an object right on top of another one in a Display icon.

Tip of the Week reader Trey Shively contributed this suggestion:

I just wanted to add a tip to the "cut and paste in place" issue.
To paste a duplicate object in the same position as it was cut from you can:
Ctrl + X, then Cntrl + Z, then Cntrl + V. It works like a charm. Of course this is only for working within the same Display icon.

I have tested this out in several versions of Authorware, and though it does not seem to work in 6.5, it does work in the others. Thank you Trey!



 

What happened last week?

My apologies for the lack of last week's Tip of the Week. I was out of town between Thursday and Tuesday, and I simply did not have time to get the newsletter out before I left. When I came back, on my first day back at work, they announced a number of layoffs, including me. Sooo...


Now taking contract work

When life throws you lemons, make lemonade. I've been wanting to go solo for quite some time now, but just couldn't let go of the security of the 8 to 5 job I had working for Job Corps. If you'd like a resume, e.mail me at ablank@ev1.net. I should be posting a resume to the website this weekend anyway.



  http://www.Authorware-Amy.com