divnet
asked on
Urgent: Page Turning Code!
I need source code to do a "page turning" like "flip album" does.
OK, im not exactly sure what you mean, by flip album.
However, if you want to add page control to your app, you can do the following:
Drop a Tpanel on your form, set its
align= alBottom.
caption = '' (NONE)
name = pnlButtons
Place two buttons on the right size of the panel.
Set the first ones Caption = 'Next' and the second one's caption = 'Prev'
Name them btnNext, & btnPrev respectively
Now drop a TPageControl on the form and set its
align = alClient
name = pgeMain
Right click on it and create as many pages as you need.
Then, set each of the tabsheets "Tab Visible" property = False
add a TActionList component to the form
double click it, and create two new actions
name the first 'actNext' and the second 'actPrev'
Set the caption's = 'Next' and 'Prev' respectively
set the actNext's OnUpdate event to the following code
procedure TfrmMain.actNextUpdate(Sen der: TObject);
begin
actNext.Enabled:= pgeMain.ActivePageIndex <> pgeMain.PageCount - 1;
end;
set the actPrev OnUpdate event to the following code
procedure TfrmMain.actPrevUpdate(Sen der: TObject);
begin
actPrev.Enabled:= pgeMain.ActivePageIndex <> 0;
end;
Now go back to the two buttons and set their action property in the obbject inspector = to the matching action
btnNext :
action = actNext
btnPrev :
action = actPrev
SHane
However, if you want to add page control to your app, you can do the following:
Drop a Tpanel on your form, set its
align= alBottom.
caption = '' (NONE)
name = pnlButtons
Place two buttons on the right size of the panel.
Set the first ones Caption = 'Next' and the second one's caption = 'Prev'
Name them btnNext, & btnPrev respectively
Now drop a TPageControl on the form and set its
align = alClient
name = pgeMain
Right click on it and create as many pages as you need.
Then, set each of the tabsheets "Tab Visible" property = False
add a TActionList component to the form
double click it, and create two new actions
name the first 'actNext' and the second 'actPrev'
Set the caption's = 'Next' and 'Prev' respectively
set the actNext's OnUpdate event to the following code
procedure TfrmMain.actNextUpdate(Sen
begin
actNext.Enabled:= pgeMain.ActivePageIndex <> pgeMain.PageCount - 1;
end;
set the actPrev OnUpdate event to the following code
procedure TfrmMain.actPrevUpdate(Sen
begin
actPrev.Enabled:= pgeMain.ActivePageIndex <> 0;
end;
Now go back to the two buttons and set their action property in the obbject inspector = to the matching action
btnNext :
action = actNext
btnPrev :
action = actPrev
SHane
Hi Shane
And I imagine that he wants some kind of animation, graphic rotation or something like that. Sometimes its really difficult to guess asker intnsions, isn't it.
Marek
And I imagine that he wants some kind of animation, graphic rotation or something like that. Sometimes its really difficult to guess asker intnsions, isn't it.
Marek
Sorry, i forgot the actual page turning.
You will need to set the OnExecute event of each of the two actions
actNext & actPrev
procedure TfrmMain.actNextExecute(Se nder: TObject);
begin
pgeMain.ActivePageIndex:= pgeMain.ActivePageIndex + 1;
end;
procedure TfrmMain.actPrevExecute(Se nder: TObject);
begin
pgeMain.ActivePageIndex:= pgeMain.ActivePageIndex - 1;
end;
You will need to set the OnExecute event of each of the two actions
actNext & actPrev
procedure TfrmMain.actNextExecute(Se
begin
pgeMain.ActivePageIndex:= pgeMain.ActivePageIndex + 1;
end;
procedure TfrmMain.actPrevExecute(Se
begin
pgeMain.ActivePageIndex:= pgeMain.ActivePageIndex - 1;
end;
Yes, it is!
However, if he want's that look as well, he can load a background image that looks like a sheet of notebook paper
http://www.sbac.edu/~tpl/clipart/Education/notebook%20paper.jpg
It all really depends on what type of effect he is looking for, so i guess i will leave it at this - until he explains more
<smile>
Shane
However, if he want's that look as well, he can load a background image that looks like a sheet of notebook paper
http://www.sbac.edu/~tpl/clipart/Education/notebook%20paper.jpg
It all really depends on what type of effect he is looking for, so i guess i will leave it at this - until he explains more
<smile>
Shane
ASKER
it is an animation effect that appears like the page is turning (like a book page). example is like www.flipalbum.com
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Mokule you have the points. I will give you more if you could show me how to curve the image, more like a book page being turned over.
ok, but my solution would habe been much less coding involved.
4 - 6 lines of code, and i bet i could have implemeted the solution
Shane
4 - 6 lines of code, and i bet i could have implemeted the solution
Shane
Never mind, i miss understood, i just tested mokules code, i see what type of effect you wanted.
Sorry, I misunderstood the question.
<Smile>
Shane
Sorry, I misunderstood the question.
<Smile>
Shane
The principle on which was based my program was as follows.
The source image rectangle was transfered into destination image parallelogram.
Src image Dest image
/E
/ |
/ |
A----------B D |
| | | |
| | | |
| | | /
| | | /
| | |/
C----------- F
PlgBlt ( PaintBox1.Canvas.Handle, // Dest image
tp, // array of points D, E, F
Image2.Canvas.Handle, // Src image
0, // x coordinate of point A
0, // y coordinate of point A
FOTWIDTH, // width of src rectangle
FOTHEIGHT, // height of src rectangle
hb, 0, 0);
If You "divide" Src image into a couple of vertical rectangles and each will be transferred independently it will be possible to more or less simulate curve. This is theory. You must apologize me but because of my "real" duties I can't try to code it yet. If You'll have some patiance may be I'll try to code it in the near future. In kind of good results I'll let You know.
Besides for achieving curve effect probably better way is use OpenGL or DirectX but I've got too little practice in that area (And lack of time at the moment).
Regards
Marek
The source image rectangle was transfered into destination image parallelogram.
Src image Dest image
/E
/ |
/ |
A----------B D |
| | | |
| | | |
| | | /
| | | /
| | |/
C----------- F
PlgBlt ( PaintBox1.Canvas.Handle, // Dest image
tp, // array of points D, E, F
Image2.Canvas.Handle, // Src image
0, // x coordinate of point A
0, // y coordinate of point A
FOTWIDTH, // width of src rectangle
FOTHEIGHT, // height of src rectangle
hb, 0, 0);
If You "divide" Src image into a couple of vertical rectangles and each will be transferred independently it will be possible to more or less simulate curve. This is theory. You must apologize me but because of my "real" duties I can't try to code it yet. If You'll have some patiance may be I'll try to code it in the near future. In kind of good results I'll let You know.
Besides for achieving curve effect probably better way is use OpenGL or DirectX but I've got too little practice in that area (And lack of time at the moment).
Regards
Marek
Sorry!
Should be of course: I must apologize You.
It's my poor English.
Marek
Should be of course: I must apologize You.
It's my poor English.
Marek
What is "page" here and what do You mean by page turning.