Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Pages at Run time

Status
Not open for further replies.

bpratl

Programmer
Jul 7, 2002
25
US
What is the best procedure to add a new Page, at run time, to a Pageframe with a Caption,code and Data from a table when activated. I am using VFP8 and am unable to find the best procedure.
Thanks in advance,
Bob
 
Simply

THISFORM.Pageframe1.PAGECOUNT = THISFORM.Pageframe1.PAGECOUNT + 1
 
Hi

1. WHen you want to add,

WITH ThisForm.PageFrame1
.Visible = .f.
.PageCount = .PageCount+1
WITH .Pages(.PageCount)
.Caption = "myCaption"
.AddObject(....)
** To add all the controls to this added page
** etc to set the data.
.Visible = .t.
ENDWITH
.Visible = .t.
ENDWITH

2. Having provided the above code., this may not alway be the best way. If you already know, what exactly is your page that you want to make available, you can create that page in the pageframe and st its visible propety to .f. When you dcide to show the page, set its visible property to .t.

3. If you acnnot decide that, you can have a pageClass created earlier and saved in your application. When, you want to add the page,
Use the addObject of the PageFrame to add your pageclass. This will help to have all the controls instatly without building them up during runtime.

:)

ramani :)
(Subramanian.G)
 
bpratl

Following ramain's suggestion of adding a pageclass, if you have a version of VFP that does not have a pageclass, create a borderless container, add your controls to the container and save it as a class.

Then add the container to the empty page using AddObject().

FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Hi, Thank you I will give your suggestion a try and let you know now I make out.
Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top