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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing a multiple-page Form

Status
Not open for further replies.

GeneK

MIS
Jan 3, 2001
2
US
I created a multiple page form using the Form Wizard. When I click the Add button to enter a new record, The first record is no problem. However, the information entered in the previous record appears in the record that follows. I think that I should add the command "thisform.refresh" somewhere, but, I'm not sure where.

Any Suggestions???
 
Hi!

However, the information entered in the previous record appears in the record that follows

Its hard to understand exactly what you meant here, but I suppose you meant "However, the information entered in the previous record appears in the page that follows"
If it is correct, that following is reason and solution.
The reason why it works by such way is in VFP ways of pages refreshing. To optimize speed of refreshing only CURRENT page refreshed when you use Refresh method of form or any container that contains page frame. This usually solved by easy way using UIEnable event of some object on the page. Do following:
1. Make simple invisible (Visible = .F.) class just for events, you can use for example line or label as base class for it.
2. In the UIEnable method of that class put following code:
LPARAMETERS plEnable
IF m.plEnable
&& refresh page after we switched to it
this.parent.Refresh
ENDIF
3. Put this class on each page of pageframe.

If you have base class for all pageframes in the application, I recommend you do not do item 3 manually but put following code in the Init of the pagerame class:

local loPage
FOR EACH m.loPage IN .Pages
&& add Page Activate object for correct refreshing
m.loPage.AddObject('oActivate', 'PageActivate')
&& 'PageActivate' - name of class for refreshing with UIEnable defined
ENDFOR

Finally, you should be aware that page will not be refreshed until you switch to it. For example, you need to calculate something using values from fields on page 2 when page 1 is active. You cannot use 'thisform.MyPages.Page2.txtMyTextBox.Value' because it could contain incorrect value. Don't use form controls for that, use field values in table that are boud to controls. In example - MyTable.MyField when thisform.MyPages.Page2.txtMyTextBox.ControlSource = 'MyTable.MyField'

Hope this helped. [sig]<p>Vlad Grynchyshyn<br><a href=mailto:vgryn@softserve.lviv.ua>vgryn@softserve.lviv.ua</a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top