Old 27th June 2003, 00:49   #1
Lilla
Junior Member
 
Join Date: Jun 2003
Posts: 46
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
Lilla is offline   Reply With Quote
Old 27th June 2003, 02:18   #2
Vytautas
Major Dude
 
Vytautas's Avatar
 
Join Date: May 2003
Location: Victoria, Australia
Posts: 643
Send a message via ICQ to Vytautas
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.
Vytautas is offline   Reply With Quote
Old 27th June 2003, 04:02   #3
Lilla
Junior Member
 
Join Date: Jun 2003
Posts: 46
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.
Lilla is offline   Reply With Quote
Old 27th June 2003, 05:04   #4
Vytautas
Major Dude
 
Vytautas's Avatar
 
Join Date: May 2003
Location: Victoria, Australia
Posts: 643
Send a message via ICQ to Vytautas
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

Last edited by Vytautas; 27th June 2003 at 07:34.
Vytautas is offline   Reply With Quote
Old 27th June 2003, 05:31   #5
Lilla
Junior Member
 
Join Date: Jun 2003
Posts: 46
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
Lilla is offline   Reply With Quote
Old 27th June 2003, 11:25   #6
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
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 Verburg is offline   Reply With Quote
Old 27th June 2003, 13:26   #7
Vytautas
Major Dude
 
Vytautas's Avatar
 
Join Date: May 2003
Location: Victoria, Australia
Posts: 643
Send a message via ICQ to Vytautas
Quote:
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
Vytautas is offline   Reply With Quote
Old 27th June 2003, 13:45   #8
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

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 29th November 2007, 13:04   #9
HarryPlotter
Junior Member
 
Join Date: Jun 2006
Location: Cologne/Germany
Posts: 4
Is it possible, that this bug (described 06-27-2003 05:02 AM) appears again in version 2.33?
HarryPlotter is offline   Reply With Quote
Old 29th November 2007, 16:11   #10
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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}.

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 2nd December 2007, 21:41   #11
HarryPlotter
Junior Member
 
Join Date: Jun 2006
Location: Cologne/Germany
Posts: 4
Thumbs up

Wow, there had been some mantraps, but I've solved the problem.
Thank you for your hint kichik.
HarryPlotter 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