Random Options Inlinks Browse Raw Live Wayback Source Home Archives: pcmedia27
http://www.corel.com/clickandcreate/tips/tip6.htm (PC Media Número 27, 1997-02-17)

[Navigation Bar]

Corel Click & Create

Tip 6 - Working with paths, INI files, Edit boxes, and a Picture object

This is a basic example which demonstrates paths, INI files, Edit boxes, and a Picture object. This example will allow developers to work with paths that aren't relative to their installed application. In this example, an INI file is used to retrieve a path to some graphic files. The user is expected to enter a valid name of a PCX or BMP file in the user entry text box. When the user presses the enter key, the application will append the file name that the user typed to the path from the INI file and display the file in the Picture box.

To try out this procedure, copy a picture file (*.PCX) to the directory C:\CNC\APPS.

In the Frame Editor, add three objects to the Click & Create playfield: a picture object with no file specified (don't enter a file name in the Picture box, just click OK); an INI object with no file specified (don't enter a file name in the INI file to use box, just click OK); and an Edit box.

In the Event Editor set events to specify an INI file and set a path variable to C:\CNC\APPS\:

  1. In the Event Editor, click the New condition box and double click the Storyboard controls icon.
  2. Choose Start of Frame from the pop-up menu.
  3. Find the empty grid box that corresponds to the new condition and is under the INI object icon. Click this grid box with the right mouse button.
  4. Choose Set current file from the pop-up menu.
  5. Type the following file name between the quotation marks in the expression box "C:\CNC\APPS\TEST.INI".
  6. Click OK. An action marker will appear in the grid box to show that the action "Set current file to "C:\CNC\APPS\TEST.INI"has been set.
  7. Click the same grid box again with the right mouse button.
  8. Choose Set current group from the pop-up menu.
  9. Type the following file name between the quotation marks in the expression box "Path".
  10. Click OK. An action marker will appear in the grid box to show that the action "Set current group to "Path"has been set.
  11. Click the same grid box again with the right mouse button.
  12. Choose Set current item from the pop-up menu.
  13. Type the following file name between the quotation marks in the expression box "Picture Path".
  14. Click OK. An action marker will appear in the grid box to show that the action "Set current item to "Picture Path"has been set.
  15. Click the same grid box again with the right mouse button.
  16. Choose Set string from the pop-up menu.
  17. Type the following file name between the quotation marks in the expression box "C:\CNC\APPS\".
  18. Click OK. An action marker will appear in the grid box to show that the action "Set item string to "C:\CNC\APPS\"has been set.

Now, we have to collect the information from the Edit box and pass it to the Picture object to display the specified picture.

  1. In the Event Editor, click the New condition box and double click the Mouse pointer and keyboard icon.
  2. Choose The keyboard, Upon pressing a key from the pop-up menu.
  3. Press ENTER.
  4. Find the empty grid box that corresponds to the new condition and is under the Picture object icon. Click this grid box with the right mouse button.
  5. Choose New picture from the pop-up menu.
  6. In the file list box, click the Expression button.
  7. Delete the quotation marks that appear in the expression box.
  8. Click the Edit button and click Retrieve data from an object.
  9. Double click the INI object and choose Get string from the pop-up menu. This will retrieve the path the was specified in the INI file. Now we want the path to be added to the file name that the user enters in the Edit box.
  10. Press the + key on your keyboard and click the Retrieve data from an object button again.
  11. Double click the Edit object and choose Get text from the pop-up menu.
  12. Click OK to accept the expression and return to the Event Editor.

Now, run the completed application. Click the Edit box and type the name of the graphic file that you copied to the C:\CNC\APPS\ directory at the beginning of the lesson. Press Enter. The graphic will be displayed in the Picture object.

[Click here for
previous tip][Click here
for next tip]

SEARCH

Click & Create

 


created with Corel WEB.DESIGNEROther useful links:
|
Copyright Information |