- NSIS Discussion
- What field to check in my StartMenuLeave function?
Archive: What field to check in my StartMenuLeave function?
Lilla
27th June 2003 01:49 UTC
What field to check in my StartMenuLeave function?
MUI 1.65, I updated via CVS this morning. Win98SE here.
I am using the logic of the StartMenu.nsi and I build on that.
My StartMenuLeave function is shown below.
My problem is that I don't know where to find the folder name entered (or selected) by the user. MUI_STARTMENUPAGE_VARIABLE contains the previous value entered (or selected) by the user.
This is my first Leave function, and I cannot find the answer.
; validate the Start Menu folder entered (or selected) by the user
Function StartMenuLeave
MessageBox MB_OK "at1 MUI_STARTMENUPAGE_VARIABLE = ${MUI_STARTMENUPAGE_VARIABLE}" ;debug
StrCmp ${MUI_STARTMENUPAGE_VARIABLE} "${MUI_PRODUCT}" PathGood
StrCmp ${MUI_STARTMENUPAGE_VARIABLE} "" PathBad
Push ${MUI_STARTMENUPAGE_VARIABLE}
Call GetFileName ; get last part of path
Pop $R0 ;$R0 is now "last part of path"
StrCmp $R0 "${MUI_PRODUCT}" PathGood
PathBad:
MessageBox MB_OK|MB_ICONSTOP "Problem with folder name. The Start Menu folder (or sub-folder) must be ${MUI_PRODUCT}"
Abort ; stay on page
PathGood:
FunctionEnd
Thank you,
Lilla
Vytautas
27th June 2003 03:18 UTC
Exacly which part of the script is not working? I compiled the script and it seemed to behave properly unless I/m missing something.
Could you post your script to see if there is some problem with it.
Vytautas
NOTE: You can also use the $9 variable to access the selected forder.
Lilla
27th June 2003 05:02 UTC
Steps to reproduce the problem:
1. Add my function to StartMenu.nsi, along with this line
!define MUI_CUSTOMFUNCTION_STARTMENU_LEAVE StartMenuLeave
2. Compile and Run.
3. When the start menu page is displayed, change the default Start Menu Folder. For example, if 'Modern UI test' is displayed, change it to 'Modern UI test #2'. Then press the Next button.
4. Observe now, the message displayed in StartMenuLeave function.
The message says:
"at1 MUI_STARTMENUPAGE_VARIABLE = Modern UI test", or
"at1 MUI_STARTMENUPAGE_VARIABLE = <empty>" if you are running it for the first time. Or,
"at1 MUI_STARTMENUPAGE_VARIABLE = <value from last run>"
Observe the problem: what is displayed IS NOT WHAT YOU JUST TYPED INTO THE FIELD!
Conclusion: the function is not using the variable that contains the field the user entered.
Vytautas
27th June 2003 06:04 UTC
OK, This is a newly introduced bug, e.g. this script works fine with the CSV(2003-06-24) but not with the CSV(2003-06-27). Sorry I didn't check this before. Its up to the DEV Team to fix this bug.
Vytautas :(
Lilla
27th June 2003 06:31 UTC
That sounds right. A few days ago I reported a problem with 'Abort' in Leave function. The 'Abort' problem was fix, and then this new problem showed up.
Perhaps this information will help the developers know where to look.
Thanks,
Lilla
Joost Verburg
27th June 2003 12:25 UTC
The custom function now uses the real leave function, which is being called before the StartMenu plug-in quits (you should be able to abort). We'll have a look at it.
Vytautas
27th June 2003 14:26 UTC
Originally posted by Joost Verburg
The custom function now uses the real leave function, which is being called before the StartMenu plug-in quits (you should be able to abort). We'll have a look at it.
Joost aborting is not the problem, its that the StartMenu plug-in has not set the MUI_STARTMENUPAGE_VARIABLE when the leave function is called.
Vytautas
kichik
27th June 2003 14:45 UTC
MUI_STARTMENUPAGE_VARIABLE is set after StartMenu quits. The MUI leave function is now called from the real leave function and not after StartMenu quits, thus the problem.
HarryPlotter
29th November 2007 14:04 UTC
Is it possible, that this bug (described 06-27-2003 05:02 AM) appears again in version 2.33?
kichik
29th November 2007 17:11 UTC
As I said, the variable is set only after the StartMenu plug-in quits. If you want to get the value in the leave callback function, you must manually retrieve it using GetDlgItem and ${WM_GETTEXT}.
HarryPlotter
2nd December 2007 22:41 UTC
Wow, there had been some mantraps, but I've solved the problem.
Thank you for your hint kichik.