home *** CD-ROM | disk | FTP | other *** search
/ Creative Computers / CreativeComputers.iso / commercial / inovatronics / candodemo / testdrivemanual / testdrive2.doc < prev    next >
Text File  |  1994-11-17  |  17KB  |  414 lines

  1. **** CANDO TEST DRIVE #2
  2.  
  3.     Now that you've completed the first Test Drive, you have learned
  4. to create objects, such as Buttons and Fields, and to tell them to do
  5. something.  Now it's time to put this basic knowledge to work by
  6. making a real application.
  7.  
  8.     You are going to make a movie database.  To assist in making
  9. database applications, CanDo comes with a Deck called "DBBaseDeck".
  10. It contains "Routines" which are useful for making many kinds of
  11. databases.  While these routines are not very complicated, in this
  12. tutorial we won't go into detail on how they work.  However, you don't
  13. need to know much about them to make use of them.  You can use them
  14. like the Editor Tools in the first Text Drive.
  15.  
  16.     So let's get started by loading "DBBaseDeck".  You are going to be
  17. using a Menu option to load the Deck.  Therefore, click on some part
  18. of the Main Panel which does not have a Button.  Now, using the right
  19. mouse button, select "Open..." from the Deck Menu.
  20.  
  21.     This will bring up the File Requester.  Click on DBBaseDeck in the
  22. File List and then select Ok.
  23.  
  24.     This will open a plain looking window.  This deck only contains a
  25. single card which does not have any Objects.
  26.  
  27. The Process for making this application is:
  28.  
  29.     ╖ Define the picture window.
  30.     ╖ Make a couple of buttons for moving around in the database.
  31.        (i.e. Next Entry, Previous Entry, Add Entry)
  32.     ╖ Make a couple of "database" Objects.
  33.     ╖ Test it out a little.
  34.     ╖ Add the remaining operations
  35.        (Search, Delete, Sort, Load and Save)
  36.  
  37.     First, let's make your window little more jazzy.  Select the
  38. Window Icon from the Main Panel.
  39.  
  40.     See Picture "Images/WindowIcon"
  41.  
  42.     Click on the Dimension Button and then the "Unnamed" Picture
  43. Button.  Now select "MovieBackdrop.Pic" and click Ok on the File
  44. Requester, Dimension Requester and finally the Window Editor.
  45.  
  46.     This will bring up a window similar to the one used in the first
  47. Test Drive but with some nice titles and imagery.  Now to add the
  48. buttons which allow you to move through the database entries.
  49.  
  50.     The first button will cause the database to move to the the
  51. previous entry.  It will use the same yellow arrow used in the first
  52. Test Drive.  Click on Add and then the Button Icon on the Main Panel.
  53.  
  54.     See Picture "Images/AddIcon"
  55.     See Picture "Images/ButtonIcon"
  56.  
  57.     Position the cross-hairs to the left of the brown box at the
  58. coordinates 15,50 , click and release the left mouse button.
  59.  
  60.     The button you are creating will cause the database to move
  61. backwards to the previous entry.  In this application you are going to
  62. give names to the Objects you create.  Change "Button#1" to "Previous
  63. Button".
  64.  
  65.     See Picture "Images/Name.PreviousButton"
  66.  
  67.     Click on the box next to "Image" and then the "Unnamed" Image Name
  68. Button.  Select "left1.br" by double-clicking it in the File List
  69. (Some people find this easier than selecting the file and clicking
  70. Ok).  Click Ok on the Image Button Requester to return to the Button
  71. Editor.  Click on the "COMPLEMENT" Highlight Button and then the
  72. "Undefined" button to select the alternate image for this button.
  73. Select "left2.br" and return to the Highlight Style Requester.  Click
  74. Ok to return to the Button Editor.
  75.  
  76.     Click on the Release Button to bring up the Script Editor.  The
  77. DBBaseDeck contains the Routines necessary for creating this, and many
  78. other database applications.  To access them, select "Routines..."
  79. from the "Special" Menu.
  80.  
  81.     This will bring up the Routine Browser.
  82.  
  83.     See Picture "Images/RoutineBrowser"
  84.  
  85.     From the list of Routine names, select "Previous Entry" by
  86. clicking on it once.  Then, click the "Insert a 'Do' to this Routine"
  87. Button.  This will create the following line.
  88.  
  89.     Do "Previous Entry"
  90.  
  91.     Click Ok to return to the Button Editor, and then Ok again to
  92. return to the Main Panel.
  93.  
  94.     Now you are going to do a similar process for creating the button
  95. which will cause the database to move the next entry.  Click on the
  96. Add and Button Icons on the Main Panel.  Position the cross-hairs at
  97. 60,50 and click and release the mouse button.  When the Button Editor
  98. appears, change "Button#1" to "Next Button".  Click on the box next to
  99. Image, and then the "Unnamed" buttons.  Select "right1.br" and return
  100. to the Button Editor.  Change the Highlight from "COMPLEMENT" to
  101. "right2.br".  Next, click on the Release button to go to the Script
  102. Editor.  Select "Routines..." from the Special Menu.  This time click
  103. on "Next Entry" and then "Insert a 'Do' to this Routine".
  104.  
  105.     Do "Next Entry"
  106.  
  107.     Exit the Script Editor and then the Button Editor by clicking
  108. their Ok buttons.
  109.  
  110.     Next you will add a Text button below the two arrows which will
  111. "Add" new entries to the database.  Click on Add and then the Button
  112. Icons.  Position the cross-hairs at 20,75, click and release the mouse
  113. button (text buttons get their size from the text).
  114.  
  115.     Change "Button#1" to "Add Button".  Click on the box next to Text
  116. to bring up the Font/Text Requester.  Change "Add Button" to " Add ".
  117. Make sure there are two space on both sides of "Add".  Because the
  118. Text buttons conform to the size of the Text, the spaces will make the
  119. button longer.
  120.  
  121.     See Picture "Images/Text.Add"
  122.  
  123.     Click on Yellow in the Color Palette and then the Shadowed button.
  124. Click Ok to return to the Button Editor
  125.  
  126.     Click on the "OUTLINE" Border Button.  Click on the Shadow style
  127. and Ok to return to the Button Editor.
  128.  
  129.     Click on the Release Button to go to the Script Editor.  Using the
  130. Routine Browser, insert a 'Do' to the "Add Entry" routine.
  131.  
  132.     Do "Add Entry"
  133.  
  134.     Exit the Script Editor and then the Button Editor.
  135.  
  136.     You've created the essential operations to add and look at
  137. database entries.  Now you need to make some "database" fields to use.
  138. In this application you are going to add a "Name" text field, a
  139. "Tape#" integer (number) field, and a "Description" document.  (These
  140. will be easy!)
  141.  
  142.     Click on the Add and Field Icons on the Main Panel.
  143.  
  144.     See Picture "Images/AddIcon"
  145.     See Picture "Images/FieldIcon"
  146.  
  147.     Position the cross-hairs at 230,52.  Press and hold the left mouse
  148. button.  Drag the mouse to the right until the width is 320 and
  149. release the mouse button.
  150.  
  151.     To make this a database field, set the Name Field to ".Name".
  152.  
  153.     See Picture "Images/Name.Name"
  154.  
  155.     When you want a Field, Document, or Button to be included in the
  156. database, the name must begin with ".", followed by a letter, and then
  157. as many letters or numeric characters (0 - 9) as you want.  (The name
  158. cannot contain spaces.) That's all you do to designate a database
  159. object.
  160.  
  161.     Click on the OUTLINE Border button and change it to the new Double
  162. Border style and click Ok.
  163.  
  164.     This Field has a Width of 320.  This leaves room for 40 characters
  165. (320 ≈ 8 pixels per character).  Click on the box, containing a
  166. checkmark, next to the title Text.
  167.  
  168.     See Picture "Images/TextCheckmark"
  169.  
  170.     This brings up the Text Requester.  Change the "Max Number of
  171. Characters" to 40.
  172.  
  173.     See Picture "Images/MaxChars"
  174.  
  175.     Click Ok on the Text Requester.  Click Ok on the Field Editor
  176. Requester to return to the Main Panel.
  177.  
  178.     Click on the Add and Field Icons.  Position the cross-hairs at
  179. 230,70.  Press-Drag the mouse to the right until the Width is 80 and
  180. release the mouse button.  When the Field Editor appears, change the
  181. Name to ".Number".
  182.  
  183.     See Picture "Images/Name.Number"
  184.  
  185.     Click on the Box next to Integer.
  186.  
  187.     See Picture "Images/IntegerBox"
  188.  
  189.     This changes the Field into an Integer Field.  This restricts the
  190. field to only containing numeric values.  This requester allows you to
  191. specify limits for these values and the initial value.  Change Minimum
  192. to 0.
  193.  
  194.     See Picture "Images/MinimumVal"
  195.  
  196.     Click Ok to return to the Field Editor.  Change the Border to the
  197. new Double Border Style.  Click Ok on the Field Editor to return to
  198. the Main Panel.
  199.  
  200.     Finally, let's add the Description Document.  Click on the Add and
  201. the Document Icons on the Main Panel.
  202.  
  203.     See Picture "Images/AddIcon"
  204.     See Picture "Images/DocumentIcon"
  205.  
  206.     Position the cross-hairs at 230,88.  Press-Drag the mouse to make
  207. the dimensions 320,64 and then release the mouse pointer.
  208.  
  209.     Set the Name to ".Description" and the Document to "Description - Doc"
  210.  
  211.     See Picture "Images/Name.Description"
  212.  
  213.     The first Test Drive used the Document Field to specify a File to
  214. load.  This Document should not load a file.  It is highly unlikely
  215. the current directory will contain a file named "Description - Doc".
  216. This way the Document will initially be empty.
  217.  
  218.     Click on the Border button and change the style to the new Double
  219. Style.
  220.  
  221.     Click Ok to return to the Main Panel.
  222.  
  223.     Now you get to see how it works.  Click on the Browse and Screen
  224. Up/Down Button.  Click in the Name Field.  Enter the name of any movie
  225. you want.  Click in the Tape# Field and set the number to something
  226. other than 0.  Finally, enter a description for the movie.
  227.  
  228.     Now, click on the Add Button (the one on your window).  The Name
  229. Field and the Document should clear and the Tape# should be reset to
  230. 0.  (If one of the Fields does not clear, then you did not correctly
  231. specify the Name.  If all three Fields stay the same, it could be one
  232. of two things:  you did not correctly specify the Name in any of the
  233. Objects or you did not correctly insert the instruction Do "Add Entry"
  234. in the Release Script for the "Add Button".)
  235.  
  236.     Enter another movie by setting all three fields.  Finally, add a
  237. third movie.  By having three movies in the database, you should be
  238. able to determine if the "Next Button" and "Previous Button" are
  239. operating correctly.  Try Clicking on the yellow arrow buttons a few
  240. times.
  241.  
  242.     If you correctly made these Objects, you should be able to Add new
  243. entries to the database, and move from one entry to another using the
  244. arrow buttons.  However, if you were to add a lot of entries to the
  245. database, it could take quite a while to find an entry.  Time to add
  246. Search capabilities.  Raise CanDo's screen and then click on the Add
  247. and Field Icons on the Main Panel.
  248.  
  249.     Position the cross-hairs at 230,165.  Press-Drag the mouse to make
  250. the Field a width of 320, and release the mouse button.  Change the
  251. name from "Field#1" to "SearchField".  Because the name does not start
  252. with a "." and it contains a space, this Field will not be included in
  253. the database.  You want to use the field for getting a Name to search
  254. for, not data to be included with each database record.
  255.  
  256.     Click on the OUTLINE Border Style and change it to the new Double
  257. Border style and return to the Field Editor.  Click on the box next to
  258. the title Text.  Set the Field "Max Number of Characters" to 40 and
  259. click Ok.
  260.  
  261.     Next, click on the Return button under "Scripts...".  Select
  262. "Routines..." in the Special Menu.  Use the slider to locate the
  263. Routine "Search For Entry" in the list of Routines.  Click on it once
  264. to select it and then on the "Insert a 'Do' to this Routine" button.
  265. This will insert the following line in your script.
  266.  
  267.     Do "Search For Entry"
  268.  
  269.     The "Search For Entry" will locate a text string in a specific
  270. record field in the database.  Therefore, you need to tell this
  271. routine two more pieces of information:  the text string to look for
  272. (it comes from this field) and the record field to search in (the
  273. ".Name" Field).  Add the following text to the end of the current
  274. line:
  275.  
  276.     ,TextFrom("SearchField"),".Name"
  277.  
  278.     The TextFrom Function, like the example in the first Test Drive,
  279. returns the current text from a field.  This text is given to the
  280. "Search For Entry" Routine.  The ".Name" tells this Routine which
  281. record field to look in.  The line should read as follows:
  282.  
  283.     Do "Search For Entry",TextFrom("SearchField"),".Name"
  284.  
  285.     Double check that the Quotes and Commas are in the correct places.
  286. This can be an easy error to make.  Add the line:
  287.  
  288.     SetObjectState "SearchField",ON
  289.  
  290.     This will cause the "SearchField" Field to remain active after the
  291. Return key has been pressed.  The Script should read:
  292.  
  293.     Do "Search For Entry",TextFrom("SearchField"),".Name"
  294.     SetObjectState "SearchField",ON
  295.  
  296.     Click Ok to return to the Field Editor and Ok again to return to
  297. the Main Panel.
  298.  
  299.     Click in the Field you just created.  Enter the name or partial
  300. name of a movie.  When you press the return key, the entry should be
  301. displayed.  Notice the Cursor in the "SearchField".  This is the
  302. result of the SetObjectState command.  You can now press return again
  303. to search for the next occurrence of the name or partial name.
  304.  
  305.     Now that you have a database, you probably want a way to save it.
  306. It would also be nice to be able to delete unwanted entries and to
  307. sort the database in alphabetical order.  Let's create some Menus to
  308. do these operations.
  309.  
  310.     Press on the Edit and Menu Icons on the Main Panel.
  311.  
  312.     See Picture "Images/EditIcon"
  313.     See Picture "Images/MenuIcon"
  314.  
  315.     This brings up a Requester allowing you to Edit the Menu Titles.
  316. You do not currently have any, so press on the Add Button.  The
  317. default name is Menu#1.  Change "Menu#1" to "Project" and click Ok or
  318. press the Return Key.
  319.  
  320.     This brings up an identical requester for the Menu Items to be
  321. added to the "Project" Menu you are creating.  Click on Add.
  322.  
  323.     This brings up the Menu Item Object Editor.  Change the Name to
  324. "Save".  Enter the letter "S" for the Short Cut Key.
  325.  
  326.     See Picture "Images/Save.Menu"
  327.  
  328.     Click on the Selected button to bring up the Script Editor.
  329. Select "Routines..." from the "Special" Menu.  Find the Routine "Save
  330. Database" and Click on it once.  Click on the "Insert a 'Do' to this
  331. Routine" button.
  332.  
  333.     Do "Save DataBase"
  334.  
  335.     Click Ok on the Script Editor and then on the Menu Item Object
  336. Editor.
  337.  
  338.     You should now see "Save" in the list of Menu Items.  Click on Add
  339. again.  You are now going to make a Menu Item to Load the previously
  340. saved version of the database.  Change the name to "Load" and give it
  341. a short cut key of "L".  Click on the Selected button.  Bring up the
  342. Routine Editor.  This time make a Do to the Routine "Load Database".
  343.  
  344.     Do "Load Database"
  345.  
  346.     Click Ok to return to the Menu Item Object Editor and Ok again to
  347. return to the Menu Item Editing System.
  348.  
  349.     You should now have both "Save" and "Load" in the List.  Click
  350. Exit.  This returns you to the Menu list.  The Menu "Project" is the
  351. one you just created containing the "Save" and "Load" Menu Items.
  352.  
  353.     You are now going to add a second Menu.  Click on Add.  Change the
  354. Name to "Options" and click Ok or press the Return key.  You are going
  355. to Add two Menu Items to "Options":  "Sort" and "Delete".
  356.  
  357.     Click on Add and change the Name to "Sort".  This time don't add a
  358. Short Cut Key (besides, "S" is already used for Save).  Click on the
  359. Selected button and insert a Do to the Routine "Sort DataBase".
  360.  
  361.     Do "Sort DataBase"
  362.  
  363.     You want to sort the database where the names will appear in
  364. alphabetical order.  As with the "Search For Entry" Routine, the "Sort
  365. DataBase" routine needs to know which record field to sort by.  Modify
  366. the line so it reads as follows:
  367.  
  368.     Do "Sort DataBase",".Name"
  369.  
  370.     This tells the "Sort DataBase" Routine to sort the database based
  371. on the text in the ".Name" field.
  372.  
  373.     Click Ok to return to the Menu Item Object Editor.  Click Ok again
  374. to return to the Menu Item list.  It should contain the single entry
  375. "Sort".
  376.  
  377.     Click on Add again.  Change the Name to "Delete".  Click on the
  378. Selected button.  Bring up the Routine Browser and insert a Do to the
  379. "Delete Entry" Routine.
  380.  
  381.     Do "Delete Entry"
  382.  
  383.     Click Ok on the Script Editor and the Menu Item Object Editor.
  384.  
  385.     That's all the Menu Items to be added to the "Options" menu so
  386. click Exit.  This will display your two Menu headings, "Project" and
  387. "Options".  Click Exit again.
  388.  
  389.     Click on Browse, lower CanDo's Screen, and Click somewhere in your
  390. window to activate it (on the Amiga, a window must be active to show
  391. its Menus).
  392.  
  393.     Press your right mouse button.  Notice the two Menu headings you
  394. created.  Select "Save" from your "Project" Menu.  Now select "Sort"
  395. in the "Options" Menu.  Using the Next and Previous Buttons you can
  396. verify the movies are in alphabetical order.  Delete one or all of the
  397. entries.  Now select "Load" from the Project Menu.  This should
  398. restore the database.
  399.  
  400.     You have now completed the Second Test Drive.  In doing so, you
  401. have created an application which would have been very complicated to
  402. make in any "high-level" programming language, and impossible to
  403. match, feature for feature, using any other software "Authoring"
  404. system.
  405.  
  406.     This little Test Drive has "shown you around the block" of your
  407. potential using CanDo.  However, the real power is getting it to make
  408. the software you really want.  When you get CanDo, you can hit the
  409. highway to unseen horizons.
  410.  
  411.     With your 10$ coupon, order CanDo today through your favorite
  412. dealer or directly from INOVAtronics at 1-800-875-8499.
  413.  
  414.