Source language: Translate to:

PageChangeName variable

General questions about NeoBook

Moderator: Neosoft Support

PageChangeName variable

Postby BRobinsonS » Thu Aug 06, 2015 8:29 am

I want to prevent a user from leaving a page if a condition exists.
i.e. in the transactions of an accounting app if the entries do not balance then inform the user and stay on the page.

I have read the help file
Optionally, the page change can be redirected or canceled by altering the value of the global [PageChangeName] variable.

The change page would be done by a Button (example: to go to the 'Main' page)
The PageChangeName variable doesn't contain the 'Main' and therefore, leaves the page.
I even set the variable to 'Main' and my app still leaves the page.

Any ideas of what I am misunderstanding?
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 340
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Re: PageChangeName variable

Postby HPW » Thu Aug 06, 2015 9:09 am

From the help:
This variable can be used to abort or redirect a page change by modifying it from within the Book Properties > Page Change Action. Upon entering the Page Change Action, this variable will contain the name of the page the reader wishes to navigate to. You can abort the page change by clearing the variable like this:

SetVar "[PageChangeName]" ""

The page change can be redirected by setting the variable to the name of another page:

SetVar "[PageChangeName]" "Error Page"


So you have to do this in the 'page Change action' in book properties Actions.

Regards
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: PageChangeName variable

Postby BRobinsonS » Thu Aug 06, 2015 9:44 am

Thanks you for your response.

Then I am not sure how to use this.

I am trying it on the 'Page Exit' tab for the page.
.CHECK TO MAKE SURE ENTRY IS BALANCED
If "[SumDifference]" "<>" "0"
MessageBox "Entry Balance" "Transactions DO NOT balance.|Do you want to leave this page?" "No|Yes" "[LeavePage]"
If "[LeavePage]" "=" "1"
SetVar "[PageChangeName]" ""
EndIf

EndIf


How would I do this?
The page I am on is 'Transactions' and the button is taking me to 'Main' page, but I don't want to go there if the numbers don't balance.
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 340
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Re: PageChangeName variable

Postby Gaev » Thu Aug 06, 2015 10:19 am

Brian:

1) Regarding the variable [PageChangeName] ... according to the Help file ...
Upon entering the Page Change Action, this variable will contain the name of the page the reader wishes to navigate to.

... so this variable is ONLY effective in the Page Change routine.

2)
I am trying it on the 'Page Exit' tab for the page.

Since the user is required to click on a button in order to request a "page change", you don't need to use the Page Change or PageExit routines ... just do the check within the button's click action code ...
Code: Select all
.CHECK TO MAKE SURE ENTRY IS BALANCED

... just for test purpose
AlertBox "SumDifference" "[SumDifference]"

If "[SumDifference]" "<>" "0"
   MessageBox "Entry Balance" "Transactions DO NOT balance.|Do you want to leave this page?" "No|Yes" "[LeavePage]"
   If "[LeavePage]" "<" "2"
      Return
   EndIf
EndIf
... SumDifference = 0 OR user chose Yes
GotoPage "Main"
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: PageChangeName variable

Postby BRobinsonS » Thu Aug 06, 2015 10:42 am

Thank you Gaev.
To my rescue again.

The page change may occur through other menu options too.
I believe I just have to check if I am on the transactions page when I want to leave through the menu and that I check like I do with the Main Button.
Perhaps a subroutine would be appropriate.
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 340
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Re: PageChangeName variable

Postby Gaev » Thu Aug 06, 2015 11:42 am

Brian:

The page change may occur through other menu options too.
Perhaps a subroutine would be appropriate.

Yes ...
Code: Select all
:ToLeaveOrNotToLeavePage
.CHECK TO MAKE SURE ENTRY IS BALANCED
If "[SumDifference]" "<>" "0"
   MessageBox "Entry Balance" "Transactions DO NOT balance.|Do you want to leave this page?" "No|Yes" "[LeavePage]"
   If "[LeavePage]" "<" "2"
      Return
   EndIf
EndIf
... SumDifference = 0 OR user chose Yes
GotoPage "Main"
Return


Then, do a GoSub "ToLeaveOrNotToLeavePage" where ever the user requests a change of page.
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: PageChangeName variable

Postby BRobinsonS » Thu Aug 06, 2015 11:51 am

Thanks again.
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 340
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 2 guests