Archive: How to delay the "Next" Button ?


How to delay the "Next" Button ?
Hey! Guys:
I want to do this:
After display one page,The "Next" Button is not enabled and The text of it begin to change to "3","2","1" second by second, and end, The button is enable.
Is it impossible to come true ?


not sure if this can be done just in the script... as a plugin you'd just need to subclass the page on show and then disable the button and on a timer, update the text as needed until the timer has looped say 3 times where you then kill the timer and enable the button. if you're not too good with win32 programming then you'll probably be confused by that all

-daz


I am wondering if this could be done by script. The problem is the timer. Perhaps you could build a function to "wait" those 3 seconds. Maybe something like the following (just an idea - untested):

Function Delay

# Change the next button
GetDlgItem $R0 $HWNDPARENT 1
SendMessage $R0 ${WM_SETTEXT} 0 "STR:3" ;setting the caption to '3'
SendMessage $R0 ...?... ; disable the next button

# $R1 is our seconds counter (counts backwards from 3 to 0)
IntFmt $R1 "0x%08X" 3 ; 3 seconds until the loop ends

# read the current time (seconds) and save in the variable $R2
${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6 ; $6 = seconds
Strcpy $R2 $6

loop:
# do some mathematics just to kill cpu time
...

# read the current seconds again and compare with $R2
${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6

Strcmp $R2 $6 loop 0 ; if different 1 second past by
Strcpy $R2 $6 ; save the current seconds again
IntOp $R1 $R1 - 1
IntCmp $R1 0 +3 +3 0 ; if $R1 = 0 jump out of loop
SendMessage $R0 ${WM_SETTEXT} 0 "STR:$R1" ; setting label to 2, 1
goto loop

; jump out of loop
SendMessage $R0 ${WM_SETTEXT} 0 "STR:Next" ; setting label back to "Next"
SendMessage $R0 ...?... ; enable the next button

FunctionEnd


The function uses the GetTime function from http://nsis.sourceforge.net/archive/...php?pageid=540 but perhaps this could be done more easely?

By the way, you should think twice to insert such delay "functionality".The installer would be the users first experience with your software and it would left a bad feeling to be forced to wait and watch at a certain page. You'd never achieve something good with this behavior.

It isn't possible in NSIS script because there's no where to execute code to perform this. If you place code in the page's Show function, the page is shown after executing the function code. Therefore it will wait 3 seconds and then show the page.

This code performs the waiting, but again there's no correct place to put this...
GetDlgItem $R0 $HWNDPARENT 1
EnableWindow $R0 0
SendMessage $R0 ${WM_SETTEXT} "" "STR:3"
Sleep 1000
SendMessage $R0 ${WM_SETTEXT} "" "STR:2"
Sleep 1000
SendMessage $R0 ${WM_SETTEXT} "" "STR:1"
Sleep 1000
EnableWindow $R0 1
SendMessage $R0 ${WM_SETTEXT} "" "STR:Next >"

-Stu


I found many user execute setup program just by click "Next" buttons and ignore all info in the page.

My purpose just is that to force user to watch license info and other notice in the io page.

Ok, I must give up my idear and use other to instead.


Hi, I write a simple plugins to do this and temporary name to Delay.
See delay.nsi for detail.:D


My opinion is that you never should harras the customer by let him wait because YOU want him to wait. The customer clearly does not as you wrote above. you only irritate the user more this way.


Good plugin!
Not only the next button but also some other controls in IO page could be delaied by this plugin!

My Suggestion: the text changing can be define,e.g.:
---------------------
push "third"
push "second"
push "first"
Delay::DelayButton /NOUNLOAD $0 3
---------------------
Then the text of the control change from "third" to "first".


OK. New version.
Input string like below.

Originally Posted by delay.nsi,2005-6-20 PM 07:02:00
;SYNTAX: Delay::DelayButton /NOUNLOAD HWND DELAY_COUNT DISPLAY_STRING
;DISPLAY_STRING separate by |
Delay::DelayButton /NOUNLOAD $0 5 "A|B|C|D|E"

bluenet can you add source code in the attachment?


OK.


Thanks


Hi, tried this plugin and it looks really good. Only one problem: Instead of "I AGREE" the delayed button show "I Agre" after the countdown ends. Even in the included demo-app. Could this be fixed?


here is the fixed version.


here is the fixed version.

fixed the bug that this plugin may not effictive in some systems.


Originally posted by bluenet
OK.
Blunet, many people include me knows that you are very proficient in NSIS, for long I have not seen you login and update your blog. Now found you here. Can you tell your latest blog site?

Originally posted by zhfi
here is the fixed version.

fixed the bug that this plugin may not effictive in some systems.
It is not work well in Simplified Chinese OS. I do not try in others.When wait for 5 seconds, a extra letter "c" appears after the text of the "I Agree".

In Chinese it turns "我接受(I)c".

see this image:

楼上这位,在我这里一切æ_£å¸¸å•Šã€‚
请确认ä½_已经用新插件替换原来的文件,或者上ä¼_ä½_的脚本让我测试一下。

It's everything ok in my computer.
Did you replace the old version plugin yet?
Can you upload your scriptfile?


Originally posted by zhfi
楼上这位,在我这里一切柣常啊。
请确认佟已经用新插件替换原来的文件,或者上伟佟的脚本让我测试一下。

It's everything ok in my computer.
Did you replace the old version plugin yet?
Can you upload your scriptfile?
It's Ok.
I forget to replace it, because I konw the code ";!AddPluginDir '.\'" is exists in the script. Just I find it start with a semicolonthe.
Good plug-in! Actually it work well!

Are you Chinese, I find 3 incorrect charactors in your reply. When Chinese charactors write in the replies, somes will be show other charactor or symbols.

right.
I think you are chinese too.
and bluenet too.


Maybe this?
Code: var paused:Boolean = true; myBtn.onPress = function() { if (paused) { stop(); } else { play();...