Class RGhost::Cursor
In: cursor.rb
Parent: RGhost::PsObject

It resposible to cursor manipulate. Use it to position objects on the page.

Methods

Public Class methods

The class method goto positioned the cursor based on page row number. Example:

  d=Document.new
  d.goto_row 15
  d.show " You're on row 15"
  d.goto_row 3
  d.show "Now you're on row 3"

  #or without facade(**it's valid for all methods on this class**)

  d=Document.new
  d.set Cursor.goto_row(15)
  d.set Show.new(" You're on row 15")
  d.set Cursor.goto_row(3)
  d.set Show.new("Now you're on row 3")

Jump n rows relative to the current row

 d=Document.new
 d.jump_row 4    # jump four rows below
 d.jump_row -5   # backing five rows to up

Move cursor to absolute point relative from default source point x=0 and y=0 of the page. It no interferes to the rows positions.

 doc=Document.new
 doc.moveto :x=> 10, :y=> 5
 doc.show "Hello Girls!!!"

(Class method) It go to next page resetting the cursors.

 doc=Document.new
 doc.show "Page 1 row 1"
 doc.next_page
 doc.show "Page 2 row 1"
 doc.next_page
 doc.show "Page 3 row 1"

Jump one next row. It‘s same that jump_row(1).

 doc=Document.new
 doc.show "Row 1"
 doc.next_row
 doc.show "Row 2"
 doc.next_row
 doc.show "Row 3"

It works the same way that moveto, the unique difference it‘s relative from current point.

 doc=Document.new
 doc.moveto :x=> 10, :y=> 5
 doc.show "Hello Girls!!!"
 doc.rmoveto :x => 5  # move to x=> 15 (10 plus 5) maintaining y => 5

Rotate all objects after execution it, passing the angle as argument.

 d=Document.new
 d.rotate 90
 #do something
 d.rotate -90  # backing to source angle

(Class method) It go to next page without resetting the cursors. Often used for single page document.

 doc=Document.new
 doc.show "Page 1 row 1"
 doc.showpage # page 2, but internally
 doc.show "Page 1 row 1"
 doc.showpage # page 3
 doc.show "Page 1 row 1"

It changes the default pont to a new point(dislocate)

 doc=Document.new
 doc.translate :x=> 2, :y=> 1
 doc.moveto :x => 0,:y => 0   # if it was default point(0,0) would be :x=> 2, :y=> 1
 doc.translate :x=> -2, :y=> -1  # return to default source point

Public Instance methods

It go to next page resetting the cursors.

 doc=Document.new
 doc.show "Page 1 row 1"
 doc.next_page
 doc.show "Page 2 row 1"
 doc.next_page
 doc.show "Page 3 row 1"

It go to next page without resetting the cursors. Often used for single page document.

 doc=Document.new
 doc.show "Page 1 row 1"
 doc.showpage # page 2, but internally
 doc.show "Page 1 row 1"
 doc.showpage # page 3
 doc.show "Page 1 row 1"

[Validate]