Old 7th April 2004, 23:56   #1
mj_igx
Junior Member
 
Join Date: Apr 2004
Posts: 10
Post Back Button not working properly

Hi All,
From a NSIS script file, I'm trying to do something like this

If the user forgets to enter input, display a messagebox that forces him to enter input.

This works fine but when I hit the back button, it displays the message box instead of navigating to the previous page.

Is there any way to read the value of Back, Next etc from the code? Do they live in register variables? I checked $R1, it's empty!

Would really appreciate any help,
Thanks in advance,
M.J.S

P.S. I'm using NSIS 2.0 and the modern UI.
mj_igx is offline   Reply With Quote
Old 8th April 2004, 10:16   #2
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Quote:
After you have called the DLL, InstallOptions adds one string to the stack, with one of the following values. [Except for the function "InitDialog" which returns the page handle.]:

success - The user has pressed the Next button
back - The user has pressed the Back button
cancel - The user has pressed the Cancel button
error - An error has occurred, the dialog cannot be displayed.
An example:

PHP Code:
InstallOptions::ShowPage "Test.ini"
Pop $
The return value is returned to variable $0.

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 8th April 2004, 12:26   #3
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Using the leave function is easier.
Joost Verburg is offline   Reply With Quote
Old 8th April 2004, 16:06   #4
mj_igx
Junior Member
 
Join Date: Apr 2004
Posts: 10
I tried the leave function approach before I posted to the forum.

page custom Foo "" leaveFoo

Function leaveFoo
;do something
FunctionEnd

When I compiled the script, it zeroed this code out...

Any idea why?


Thanks,
M.J.S
mj_igx is offline   Reply With Quote
Old 8th April 2004, 16:25   #5
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Page custom Foo leaveFoo
Joost Verburg is offline   Reply With Quote
Old 12th April 2004, 23:04   #6
mj_igx
Junior Member
 
Join Date: Apr 2004
Posts: 10
Cool, thanks for the help. This works for me. I'm still a little unclear on how I would find the variable in which "back" is stored.

Thanks,
Malathi
mj_igx is offline   Reply With Quote
Old 14th April 2004, 17:50   #7
mj_igx
Junior Member
 
Join Date: Apr 2004
Posts: 10
Just wonderinf if anyone has answers to the question that I posted...

Thanks.
mj_igx is offline   Reply With Quote
Old 14th April 2004, 18:09   #8
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
You mean the text of the button? See the language file for the language string name.
Joost Verburg is offline   Reply With Quote
Old 14th April 2004, 18:35   #9
mj_igx
Junior Member
 
Join Date: Apr 2004
Posts: 10
Thanks for your response. I'm actually trying to get this to work for me...

Function customPage

; Do something to get R1. Not sure what exactly...
StrCmp $R1 "back" _goback done
_goback:
Call Foo ;to go back to the previous custom page
done:

FunctionEnd


Thanks Again,
mj_igx is offline   Reply With Quote
Old 14th April 2004, 18:37   #10
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
If you want to stay on the current page use Abort in the leave function.
Joost Verburg is offline   Reply With Quote
Old 14th April 2004, 18:43   #11
mj_igx
Junior Member
 
Join Date: Apr 2004
Posts: 10
Nope. Want to go back to the previous screen. Foo actually reads in values from Foo.ini.
mj_igx is offline   Reply With Quote
Old 14th April 2004, 19:21   #12
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
You can also use Abort in the pre function to stay on the current page.

What exactly are you trying to do? When do you want to go back?
Joost Verburg is offline   Reply With Quote
Old 14th April 2004, 20:17   #13
mj_igx
Junior Member
 
Join Date: Apr 2004
Posts: 10
Function Bar LeaveBar
_start:
;If the user forgets to enter input
goto _start
FunctionEnd

Function Foo
_start:
;If the user forgets to enter input
goto _start
Function End

Function LeaveBar
; If the user hit the back button( how do I know this?) Call Foo
;else goto _done
_done:
FunctionEnd

Here Screen 1 inovolves Foo. We are on screen 2 (involving Bar) trying to hit back to get to Screen 1 again...

If the goto _start is not present it works perfectly but this is not an option for me as I want to force the user to enter input.

Thanks,
Malathi
mj_igx is offline   Reply With Quote
Old 14th April 2004, 21:01   #14
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
I don't really understand what you mean. Do you want to go back to page 1 when validating page 2? Why?
Joost Verburg is offline   Reply With Quote
Old 14th April 2004, 21:10   #15
mj_igx
Junior Member
 
Join Date: Apr 2004
Posts: 10
Nope. What I want to do is to go back to Page 1 whenever the user hits back even if all the entries for the required fields are blank. I'm able to accomplish this for cancel i.e irrespective of the state of the required fields, I'm able to cancel out of the installer by inserting a simple strcmp function. All I want is to do the same for back but I dont know how to get hold of the variable that is populated when the user hits back.

Thanks
mj_igx is offline   Reply With Quote
Old 14th April 2004, 21:13   #16
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
The leave function is only called when the user clicks Next.
Joost Verburg is offline   Reply With Quote
Old 14th April 2004, 21:24   #17
mj_igx
Junior Member
 
Join Date: Apr 2004
Posts: 10
Ahh..Any other options? All I want to do is
StrCmp $UserHitBack "Back" Call Page1

Problem is I dont know how I can get the variable that the installer stores the value of the back button in...Is it one of the register variables?

Thanks
mj_igx is offline   Reply With Quote
Old 15th April 2004, 08:52   #18
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Please explain exactly what feature you want. If a user clicks Back it will of course go the to previous page. What else do you want?
Joost Verburg is offline   Reply With Quote
Old 21st April 2004, 21:46   #19
mj_igx
Junior Member
 
Join Date: Apr 2004
Posts: 10
I think I have this figured out. Thanks for your help. Will let you know how it goes...

Basically, the problem stems from the loop that I'm using to force the user to enter input. Moving the loop to the leave function fixes it.

Thanks,
Malathi
mj_igx is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump