Practice 5
Creating an association with indirect references

In this exercise we will make an association between photographs of the planets and their names. The photographs are in some GIF files that you should find in the working directory if you followed the instructions that we gave at the beginning carefully.

We will not be able to use the select Image type option for grid B in this exercise as there are 9 photographs in 9 separate files rather than just one image and only one file can be selected from the drop list. We will have to use the indirect call technique, writing the file names in a text file.

- Go to the File - New... - Association menu. We will use the same working directory as before.

- Select the PLANETS.TXT file from the previous exercises for grid A.

- You will have to create a NEW TEXT for grid B. Click on the Edit contents button and, when Clic asks, call it IMGPLANE

- In the note pad write the following lines:

{mercury.gif}
{venus.gif}
{earth.gif}
{mars.gif}
{jupiter.gif}
{saturn.gif}
{uranus.gif}
{neptune.gif}
{pluto.gif}

It is important to write the file names between curved brackets "{" and "}" and not to confuse them with square brackets "[" and "]". It is also important not to leave any spaces at the beginning or the end of any of the lines.

By writing the file names between curved brackets in a text file, Clic will display their contents within the cells rather than the literal expression of each line.

- Save the file and close the note pad.

- Set the layout at 3 rows and 3 columns.

- In Welcome message write:

Match each planet with its photograph

- ...and in Good bye message:

Very good!

- Click OK and test the activity.

- Save it as PLANET3.ASS

It works... but some of the photographs are cut off. We could consider changing the cell distribution to improve this, by putting the list of names in a single column on the left and keeping the 3x3 grid for the photographs. Here are the steps to follow:

- Use CTRL+E to activate the edit window (the shortcut for the Edit - Edit activity menu).

- Change the Kind to Complex association. You need to make this change because it is not possible to have different cell layouts for the two grids in normal associations.

- Change the layout to 1 column and 9 rows. This should affect grid A.

- Click on the Relationship assignment button and change the setting to 3 for both B Rows and B Columns.

- Click on each of the lines in the list on the left to check if the relationship assignment is still correct. The same row on the right should be automatically selected. If this is not the case, mark it.

Click OK to return to edition and OK again to test it. Indeed, the layout has changed, but the cells in grid A are too big and the ones in grid B are too small.

Before modifying the cell dimensions, we shall do a few simple calculations:

The planet images have maximum dimensions of 100x100 pixels (you can check this with PaintShop Pro or another graphic editor). To leave a bit of a margin between the photographs, we could give the cells in grid B dimensions of 120x120. This will give a total of 360x360 for grid B.

There are now 9 rows in grid A, while B still has 3. For both grids to have the same height, the cells in grid A would have to be a third of those in B. A third of 120 is 40 pixels.

Here are the steps to modify the cell dimensions:

- Edit the activity (CTRL+E) and click the Options button.

- Change the width settings in both grids to 120 and the height settings to: 40 in A and 120 in B.

- Confirm everything and check how the activity looks. It should now have a more appropriate distribution.

Grid B would look better if the cells had a black background:

- Edit the activity (CTRL+E) and click the Fonts button.

- Mark the Grid B box (it is very important to always select the area before changing colours or fonts).

- Click on the Background button and select black.

- Click on Text and select white. Even though there is no text in grid B, it is always a good idea to avoid having the same text and background colour in case the activity is changed at a later date.

- Confirm everything and check how the activity looks now.

- To avoid the dividing lines appearing between the cells in grid B, edit the activity and unmark Delimit cells.

- Save the activity again with the same name, PLANET3.ASS