PrintPreview BeginEdit EndEdit question

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

PrintPreview BeginEdit EndEdit question

Postby lbc » August 2nd, 2005, 7:56 am

Hello
I have read in the TPrintPreview documentaton that there are the
function BeginEdit and the procedure EndEdit in order to edit an existing page.

Is there available some simple code snippet to see how to use these feature?

thank you
lbc
Junior Member
Junior Member
 
Posts: 48
Joined: February 4th, 2004, 7:50 am
Location: Italy

Postby Kambiz » August 2nd, 2005, 8:05 am

There's nothing particular. Just inside BeginEdit/EndEdit block, use PrintPreview.Canvas to update the page.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby lbc » August 2nd, 2005, 11:14 am

Hi Kambiz thank you again
so it's better to use BeginEdit/EndEdit to edit items in a page instead of recreate a page (within the BeginDoc/EndDoc block)?
lbc
Junior Member
Junior Member
 
Posts: 48
Joined: February 4th, 2004, 7:50 am
Location: Italy

Postby Kambiz » August 2nd, 2005, 12:35 pm

It depends on what you are going to modify.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby lbc » August 2nd, 2005, 6:55 pm

Hello Kambiz
let's say some graphical items drawn by the user on a drawing canvas

for example imagine the user moving a rectangle over a panel on the left and wishing to get the print preview on the right immediately updated to watch how looks the "real page" paper preview as he moves the shapes around.

for similar purposes could be used the BeginEdit/EndEdit block?

thanks again
lbc
Junior Member
Junior Member
 
Posts: 48
Joined: February 4th, 2004, 7:50 am
Location: Italy

Postby Kambiz » August 3rd, 2005, 10:02 am

In your example, you have to consider that the BeginEdit/EndEdit block doesn't cause the old drawn rectangle be erased.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby lbc » August 3rd, 2005, 2:31 pm

Hi Kambiz
ok, so basically with the BeginEdit/EndEdit I can use the canvas of an existing page to add new items (for example draw new rectangle, some text out ecc.).

As a test I have tried the following

Code: Select all
 with PrintPreview do
  for PageNo := 1 to TotalPages do
    if BeginEdit(PageNo) then
      try
        // write a simple test text
        Canvas.TextOut(10,10,'EDITING PAGE: '+IntToStr(PageNo));
      finally
        EndEdit;
      end;
lbc
Junior Member
Junior Member
 
Posts: 48
Joined: February 4th, 2004, 7:50 am
Location: Italy

Postby Kambiz » August 4th, 2005, 11:16 am

Yes, this is exactly what BeginEdit/EndEdit block is supposed to do.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby lbc » August 4th, 2005, 4:21 pm

Hi Kambiz thank you
well now I got the correct purpose of a BeginEdit/EndEdit block
lbc
Junior Member
Junior Member
 
Posts: 48
Joined: February 4th, 2004, 7:50 am
Location: Italy


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 1 guest

cron