Old 8th October 2003, 20:28   #1
psyke
Member
 
Join Date: Mar 2003
Posts: 65
Question how to change behaviour of back button?

hello.

I am hoping that somehow, it would be possible to change the behaviour of the back button.

I am using the back button (with BackButtonText=Help in the .ini file) in an InstallOptions page, as a 'Help' button.

When the user clicks on 'Help' I launch a readme via execwait, but when the readme closes, the installer goes to the license page (which comes before the custom installoptions page). I know that this is the correct behaviour, because the user did press 'back' after all.

But i really wish to make back button not do this, i have tried putting abort into license page, but this causes license page to be skipped when help button is pressed, it is even worse for what i want.

I hope some solution is possible. (please! )


thank you.
psyke is offline   Reply With Quote
Old 8th October 2003, 20:48   #2
psyke
Member
 
Join Date: Mar 2003
Posts: 65
I just wanted to say that I am checking the return value from installoptions for 'back', but i don't know what i can do when i detect 'back' was pressed to stay on the current (installoptions) page.
psyke is offline   Reply With Quote
Old 8th October 2003, 20:50   #3
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:
Page custom [creator_function] [leave_function] [caption]...
You can use the leave_function to detect the variable (use $0 to $9 or custom ones) given by your page, and use abort, to go back to the page. Like this:

PHP Code:
Page custom "YourCustomPage" "Help"

Function Help

# Return the page result to the variable $9

  
StrCmp $"back" Continue

    
ExecWait "Readme.txt"
    
Abort

  
Continue:

FunctionEnd 

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 8th October 2003, 20:56   #4
psyke
Member
 
Join Date: Mar 2003
Posts: 65
Thank you deguix!

I am testing your suggetion right now, but i thought I tried this already and it didn't work. :|

According to the docs:
Quote:
the leave-function is called right after the user has pressed the next button and before the page is left
So it sounds like the leave function is not called when 'back' is pressed.

But i will try.

update: It looks like the docs were right (they usually are ) the leave function is not being called when back is pressed.)

Maybe there's something I could do in the license page's pre function to skip to the next page (which would be the page I didn't want to leave in the first place, lol).
psyke is offline   Reply With Quote
Old 8th October 2003, 21:12   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You best bet probably lies with this plug-in. It will also allow the user to actually go back

You can also just call InstallOptions again if it returned "back". NSIS will only use the last button clicked and the user will have to click next or cancel eventually.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 8th October 2003, 21:17   #6
psyke
Member
 
Join Date: Mar 2003
Posts: 65
Oh yes, DrO's plugin - i was going to do that kichik but for the NT4 crash. :| (I did search the forums first - yay for me. )

I am intrigued by your other option... so I could do something like:
Quote:
show_helppage:
InstallOptions::dialog "help_page.ini"
Pop $R9
.
.
.
StrCmp $R9 "back" 0
ExecWait '$PLUGINSDIR\readme.html'
Goto show_helppage
.
.
.
I will try that.

Thank you.

update: I tested Kichik's suggestion. Of course, it worked!!

Kichik == life saver. (Even more than the docs.)
psyke is offline   Reply With Quote
Old 8th October 2003, 21:21   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Yes, that should work except for the ExecWait part. An HTML file is not executable, you should use ExecShell. I would also not recommend waiting for the readme to close because that will cause the page to flicker. If you don't wait for it, the flicker will occur behind the scenes while the user is reading the readme.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 8th October 2003, 21:22   #8
psyke
Member
 
Join Date: Mar 2003
Posts: 65
Of course. Thank you Kichik, I was being very hasty, I appreciate that you pointed out my mistakes.
psyke is offline   Reply With Quote
Old 11th October 2003, 16:50   #9
DrO
 
Join Date: Sep 2003
Posts: 27,873
was it a txt or html file that you were trying to show?

haven't had much chance to work on the code - almost tracked down the NT issue (got it to crash at a fixed point in memory, not the hook proceedure anymore at least)

i was considering adding in reading a txt/rtf file from a specified file instead of being defined in the script. may even look at getting a html file correctly displayed in the window (thinks of the trouble in coding it )

-daz
DrO 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