Totally Objects Home Page Turtle Graphics

What's New? Products Totally Objects Downloads Other Downloads Consultancy VAST Training
Educational Discounts See what our clients think Buy News Groups Consultant's Pack Contact Us

IntegratingTurtle Graphics into Visibility 

Creating a page in standard Visibility

Each Visibility process needs to be set up in a standard way. Visibility Users are familiar with this process. Basically, the steps for standard Visibility are as follows:

  1. Create a sub-class of VisibilityPagePrinter
  2. Instantiate an object and initialise it using
    self
    init: ##portrait
    processName: 'Visibility turtle test print'
    on: ##default
    "This creates a portrait based page on the default printer. The process name is what you see in the printer output list'
  3. Create a list of print objects using the standard set of Visibility object creators.
  4. Put these into a VisibilityHoldingCollection. This is a special form of OrderedCollection that is initialised to either portrait or landscape depending upon how you want the page to come out. 
  5. Add this holding collection to the in-built collection that holds all the pages - called printList. Thus: self printList add: myHoldingCollection.
  6. If you want any more pages, create them in the same way and add them to printList as in 5 above.
  7. Print the pages using the code
    printer printDoc: printList "using the built in printer instance in your class"

To see a preview instead of printing the pages, use printer previewDoc: printList in 7 above.

Using Turtle Graphics instead of the standard print objects

Firstly, remember that all that the Turtle Graphics is doing is wrappering up the calculations and object creation used in a normal Visibility page. Thus all of the steps above are valid except lines 3, 4 and 5. Line 3 is replaced by the following:

3a. Create an instance of VisibilityTurtle
3b. Issue all of the wanted turtle commands to that turtle

4. The turtle has an instance variable called outputList. This now contains the VisibilityHoldingCollection which holds the Visibility print objects that represent the turtle output. so this instruction is now redundant.

5. Now reads: Add the turtle holding collection to the inbuilt collection that holds all the pages - called printList. Thus: self printList add: myTurtle outputList.

From here on in, the process is the same as before.

Integrating Turtle Graphics with the VisPrintPreviewTestWindow

This window is the demonstrator showing how to integrate a Visibility preview into a dynamic window. This window provides the following facilities:

This demonstration utilises some methods in VisibilityDemo (the built in class of demonstrations in the use of Visibility features). To use the preview window with standard Visibility, the makePages method in VisPrintPreviewTestWindow looks like this:

makePages

self originalPages: (VisibilityDemo new
                         buildPagesOn: (self subpartNamed: 'PP') printerName).
self setWantedPage.

To use the turtle, you simply ensure that the code within buildPagesOn: uses the turtle as described above. 

Back to Turtle Graphics home page


Back to Totally Objects Home Page