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!

Activate Page wont Activate when added

Status
Not open for further replies.

bpratl

Programmer
Jul 7, 2002
25
US
I have a form with 8 pages with the Pagecount set to 1 for INIT load. The Pagecount is advanced when another service request is added with a new Caption. This work good except when a new page is added( Pagecount+1) the activate event wont work. All eight pages have This.Refresh()in the Activate event. If I close and reopen the form it works ok.
The last page only sees the data from the previous page.
 
Not sure I understand, but are you trying to change the pages through code?


Thisform.pageframe1.ActivePage = 3


Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Yes, I am tring to add & delete pages at run time with code.
Removing a Page (Pagecount-1) works well. If I the Pagecount=3 (three service requests) and I add a new request with Pagecount=Pagecount+1 the new Page is added with the proper Caption; but when I click on it,it wont activate and select the correct Record for the new page.
The Activate event wont trigger. Each of the eight pages have update methodes & This.Refresh() in the Activate events.
 
Bprati,

I can't see how that would work. You are saying you create eight pages in the form designer, but set the page count to 1 in the Init? Later, you increase the page count. You also have code in the each page's Activate event, which you presumably add at design time?

If I've understood it right, by setting the page count to 1, you are destroying pages 2 - 8 that you created at design time. You are also destroying the code in those pages' Activate event. When you later increase the page count, you will be creating new pages, without the code. So the Refreshes won't fire, and you won't see the new page.

In VFP 8.0, you can solve that problem by creating a page class, and setting the member class of the pageframe to point to it.

I'm not sure what to suggest if you are using an earlier version. Maybe hide the tabs, and provide some other control for letting the user move between tabs. That way, you won't have to change the page count -- just don't let the user go to the pages that you want to hide.


Mike


Mike Lewis
Edinburgh, Scotland
 
Mike, the eight pages and code are not destroyed only not visable if I set the pagecount to 1. If I change the pagecount to 3 the form will now show 3 pages which still have the code in the Activate event. The Activate event will only fire if I release the form and reopen with the new pagecount. The pagecount is updated by the number of repair order records for a given invoice number in a Repair table when the form is opened or a new service request is added. I tried to add pages to the page frame with Addobject; but I do not know now to add code to the page at runtime.
Bob
 
maybe you should try refreshing the entire form.

ThisForm.Refresh

kilroy [trooper]
 
Hi Bob,

1. What code you are using to refresh the forms.
2. WHen you add a page..

WITH ThisForm.PageFrame1
.Visible = .f.
.Pagecount = .Pagecount+1
.Pages(PageCount).Caption.... etc
.Visible = .t.
.Refresh()
FOR EACH oPage IN This
oPage.Activate()
oPage.Refresh()
.. whatever...
ENDFOR
ENDWITH

:)

ramani :)
(Subramanian.G)
 
Hi,
This procedure is called during form activate event and adding a new page


if type('thisform.mRo')='N' && a valid repair order #
sele AORD && labor description
count for RONO = thisform.mRo to thisform.nPage
ThisForm.GroupPages.pagecount=Thisform.nPage
set order to GROUP
endi
set filt to RONO = thisform.mRo
go top
*check all groups and add new caption & COLOR to pages from AORD.dbf
if Thisform.nPage>0
for NEX = 1 to Thisform.GroupPages.PageCount
cPage='Page'+ltrim(str(NEX))-'.'
cGP='PG'+ltrim(str(NEX))-'GP'
Thisform.&cGP=aord.Group && used to link page#
ThisForm.GroupPages.&cPage.Caption = trim(ro_dept.Desc)
ThisForm.GroupPages.&cPage.foreColor=rgb(&pageSet(nex,2))
skip
endfor
* The following has no effect
Thisform.Lockscreen=.t.
ThisForm.GroupPages.ActivePage=Thisform.nPage
ThisForm.GroupPages.&cpage.Setfocus
Thisform.lockscreen=.f.
Thisform.GroupPages.Refresh
Thisform.udinvoice()
Many thanks
Bob (newbee to VFP 8)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top