Archive: Message Box Problem with MUI_INSTALLOPTIONS_WRITE


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


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.


I tried all combinations (\n, \r, \r\n, \n\r) and NONE does work!

Tom


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.


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

You need to use \r\n (without the $).

-Stu


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


That applies to NSIS code, not InstallOptions INI files.

-Stu