home *** CD-ROM | disk | FTP | other *** search
/ Painter Bear's Language Bridge — Italian / Bridge_ponte_itialian.iso / pc / xtras / -pmatic.dir / docs_4.txt < prev    next >
Encoding:
Text File  |  1999-09-22  |  2.6 KB  |  59 lines

  1. Creating, Destroying and Resetting Documents
  2.  
  3. The following commands are used to create and reset PrintOMatic documents:
  4.  
  5.     new        creates a new document
  6.     forget     never call this directly
  7.     reset      resets a document to defaults
  8.     
  9. To destroy a document, never call the forget method of an Xtra explicitly. Instead, use the following syntax to explicitly get rid of a PrintOMatic document when you are done using it:
  10.  
  11.     set doc = 0
  12.  
  13.  
  14. new
  15.  
  16. Syntax:    set doc = new(xtra "PrintOMatic")
  17.  
  18. The new command is used to create a new instance of the PrintOMatic  Xtra. The newly created instance is called a document object, since it represents a printable "document": a collection of items that are printed together in a single print job by PrintOMatic. 
  19.  
  20. Once the document has been created, its settings can be modified, items can be appended to the document, and it can be printed or displayed in a print preview window.
  21.  
  22. Important Note:
  23.  
  24. new will return an error code instead of a document object if there is no currently selected printer, or a printing error occurs. Always check the result of new with the objectP() function to make sure you have a valid Xtra instance before continuing!
  25.  
  26. Example:
  27.  
  28. The following code example creates a new document, sets the page orientation to landscape mode, creates a new page and "frame" on the page, appends an image with a caption to the document, and prints the document:
  29.  
  30.     set doc = new(xtra "PrintOMatic")
  31.     if not objectP(doc) then exit
  32.     setLandscapeMode doc, TRUE
  33.     newPage doc
  34.     newFrame doc, Rect(0,0,getPageWidth(doc),getPageHeight(doc))
  35.     append doc, member "picture", TRUE
  36.     append doc, RETURN & "Image printed by the PrintOMatic Xtra.", TRUE
  37.     if doJobSetup (doc) = TRUE then print doc
  38.     set doc = 0
  39.  
  40.  
  41. forget
  42.  
  43. You should never call the forget command directly for an instance of a Lingo Xtra. Director automatically calls forget  when an instance of an Xtra needs to be disposed; calling forget yourself can lead to memory leaks or crashing.
  44.  
  45. Use the following syntax to explicitly get rid of a PrintOMatic document when you are done using it:
  46.  
  47.     set doc = 0
  48.  
  49. Where doc is the PrintOMatic document you want to dispose of. Explicitly disposing of documents is optional, since Director will automatically get rid of the object when it's no longer referenced anyway.
  50.  
  51.  
  52. reset
  53.  
  54. Syntax:    reset document
  55.  
  56. The reset command is used to reset an instance of a PrintOMatic document. All the contents of the document and any existing pages are deleted. The page settings, such as margins and page orientation, as well as the progress dialog settings, are maintained; they are NOT reset to default values.
  57.  
  58.  
  59.