General information
Category:
Forms & Form designer
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only