Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stop page change in a pageframe during a lostfocus??
Message
From
15/08/2000 15:56:00
 
 
To
15/08/2000 15:34:49
Peter Brama
West Pointe Enterprises
Detroit, Michigan, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00405163
Message ID:
00405173
Views:
21
Try creating a method on your form called CheckPageChanged and a property called nPageNo and nLastPageNo. Then, in the activate of each page, put the following code:

Thisform.nPageNo = Thisform.Pagframe1.Activepage
IF THISFORM.nPageNo <> THISFORM.nLastPageNo
THISFORM.checkpagechanged()
THISFORM.PAGEFRAME1.ACTIVEPAGE = THISFORM.nPageNo
ENDIF

Then, in the CheckPageChanged method, put code that runs specific code needed for each page in your page frame in a Do Case...EndCase to determine if you want to allow the user to leave the previous page. If you need to stay on the current page, just set the nPageNo property to the page you want to stay on. Be sure to set the value of nLastPageNo to nPageNo in the checkpagechanged method if you are allowing the user to move off the page.

*here is an example of what I have in my CheckPageChanged method:
IF THISFORM.datachanged()
IF THISFORM.asktosave() = IDCANCEL
*!* user chose cancel - do not move to selected page
THISFORM.lcancel = .T.
THISFORM.nPageNo = THISFORM.nLastPageNo
ENDIF
ENDIF

* everything is o.k. - move on to selected page
thisformset.nRecordNo = 0
THISFORM.nLastPageNo = THISFORM.nPageNo
Previous
Reply
Map
View

Click here to load this message in the networking platform