tbednarz
23rd May 2006 07:29 UTC
Message Box Problem with MUI_INSTALLOPTIONS_WRITE
When using MUI_INSTALLOPTIONS_WRITE, message Boxes show only ONE line and CUT the text after the first escaped CR/LF($\n)!
I have the following code:
;------- Validation Messages ------
LangString SK-TEXT_VALIDATE1 ${LANG_ENGLISH} "Please enter a correct subscription key.$\n(16 characters without any spaces or dashes)"
LangString SK-TEXT_VALIDATE1 ${LANG_GERMAN} "Bitte geben Sie einen korrekten Abonnements-Key ein.$\n(16 Zeichen ohne Leerzeichen oder Bindestriche)"
....
; -- Language specific validation error messages
!insertmacro MUI_INSTALLOPTIONS_WRITE "SubscriptionKey.ini" "Field 3" "ValidateText" "$(SK-TEXT_VALIDATE1)"
If an illeagal or wrong string is entered, an error meassage appears. The problem is, that only the text BEFORE the CR/LF is shown. If I do NOT add CR/LF the whole screensize is used before it wraps text!
Is this a bug and is there an work-around? Just as a sidenote: If I use
MessageBox MB_RETRYCANCEL|MB_ICONSTOP "$(SK-ERROR_INETCALLFAILED)" IDRETRY Loop
to display an error message, the escaped CR/LF work just fine!
Many thanks for your help.
Tom
Red Wine
23rd May 2006 12:00 UTC
From InstallOption documentation:
"For Text fields with the MULTILINE flag, \r\n will be converted to a newline."
You may want to refer to IO documentation.
tbednarz
23rd May 2006 15:52 UTC
I tried all combinations (\n, \r, \r\n, \n\r) and NONE does work!
Tom
Red Wine
23rd May 2006 17:10 UTC
This:
"SubscriptionKey.ini" "Field 3" "ValidateText"
is not a valid IO ini file
Should be:
"SubscriptionKey.ini" "Field 3" "State"
and that "Field 3" must be a Text field with MULTILINE flags.
Red Wine
25th May 2006 11:59 UTC
Completely misunderstood the reference on ValidateText above :-) Sorry guys...
Anyway I made an own test thus the new line issue works fine for this test.
!define Valid_Text "Error\r\nYou must type something here\r\n\
between 4 to 8 chars max.\r\nPlease try again"
outfile 'test.exe'
page license
page custom page_test
page instfiles
function .onInit
InitPluginsDir
file /oname=$PLUGINSDIR\validtest.ini 'validtest.ini'
functionend
function page_test
WriteIniStr '$PLUGINSDIR\validtest.ini' 'Field 1' 'ValidateText' "${Valid_Text}"
Push $0
InstallOptions::initDialog /NOUNLOAD '$PLUGINSDIR\validtest.ini'
Pop $0
InstallOptions::show
Pop $0
functionend
section -
sectionend
; name it validtest.ini
[Settings]
NumFields=1
[Field 1]
Type=Text
MaxLen=8
MinLen=4
ValidateText=error
State=Text Field
Left=30
Right=120
Top=12
Bottom=25
Afrow UK
25th May 2006 15:14 UTC
You need to use \r\n (without the $).
-Stu
tbednarz
26th May 2006 08:23 UTC
Huuuuh! The $-sign was the problem. I thought escaping sequencies must start with a $-sign?
At least in the help file, chapter '4.1 Script File format' it says:
...
Strings
...
It is also possible to put newlines, tabs etc. in a string using $\r, $\n, $\t etc. More information...
.....
However without the $ sign it works perfect. Thanks a lot for your help guys!
Tom
Afrow UK
26th May 2006 08:36 UTC
That applies to NSIS code, not InstallOptions INI files.
-Stu