Archive: nsDialogs read-only text box


nsDialogs read-only text box
Hi,
I am trying to create a custom page using nsDialogs that displays a text box containing a clickable URL , but that is not editable by the user.

Currently I am doing this :
Function MirrorPageFunc
nsDialogs::Create /NOUNLOAD 1018
Pop $Dialog

${If} $Dialog == error
Abort
${EndIf}

${NSD_CreateLabel} 0 0 100% 12u "Test"
Pop $Label

${NSD_CreateText} 0 13u 100% -13u "Test : www.google.ca"
Pop $Text

nsDialogs::Show
FunctionEnd

Actually, I am trying to reproduce the dialog I included as an attachment to this post. AKAIK, the installer that provides that dialog is not built with NSIS, but I'm hopeful it can be done using NSIS.

Does anyone have a clue ?

Thanks
Alexis


and you can't use a customized license page instead of nsDialogs?


You have to create a rich text control.

Stu


Anders : I already use the license page at the beginning of my installer. The page I need to display must be at the end of the installation.

Afro : Indeed this seems to be what I am looking for. If I understand the doc correctly, there is no existing macro to create such a control, but I can do it directly, bypassing the lib entirely.

I couldn't find any example on how to do so, though. Do you have any pointer for me ?

Thanks to both of you.


Alright, I read all day to get somewhere. Only thing that does not work : clicking on a URL does not do anything.

Here is my code :
Var Dialog
Var Label
Var Text
Var CONTROL

!define SF_RTF 2
!define EM_STREAMIN 1097
!define EM_EXLIMITTEXT 1077

Function MirrorPageFunc
nsDialogs::Create /NOUNLOAD 1018
Pop $Dialog

${If} $Dialog == error
Abort
${EndIf}

nsDialogs::CreateControl /NOUNLOAD "RichEdit20A" ${ES_READONLY}|${WS_VISIBLE}|${WS_CHILD}|${WS_TABSTOP}|${WS_VSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN} ${WS_EX_STATICEDGE} 0 10u 100% 90u ''
Pop $CONTROL

FileOpen $4 "1.rtf" r

StrCpy $0 $CONTROL

SendMessage $CONTROL ${EM_EXLIMITTEXT} 0 0x7fffffff
; set EM_AUTOURLDETECT to detect URL automatically
SendMessage $CONTROL 1115 1 0

System::Get /NoUnload "(i, i .R0, i .R1, i .R2) iss"
Pop $2
System::Call /NoUnload "*(i 0, i 0, k r2) i .r3"

System::Call /NoUnload "user32::SendMessage(i r0, i ${EM_STREAMIN}, i ${SF_RTF}, i r3) i.s"

loop:
Pop $0
StrCmp $0 "callback1" 0 done
System::Call /NoUnload "kernel32::ReadFile(i $4, i $R0, i $R1, i $R2, i 0)"

Push 0 # callback's return value
System::Call /NoUnload "$2"
goto loop
done:
System::Free $2
System::Free $3
FileClose $4

nsDialogs::Show
FunctionEnd

The RTF file only contains a string :
http://www.google.ca
I can see the string being blued and underlined, and the mouse cursor changes from the regular arrow to a hand with a little pointing finger. However, clicking does nothing.

Any hints ?

Alexis


There is nothing stopping you from using more than one licensepage.

Also checkout http://nsis.sourceforge.net/Readme_P...I_License_Page

If you still want to use nsDialogs, you must do:

SendMessage(hwLicense,EM_SETEVENTMASK,0,ENM_LINK|ENM_KEYEVENTS);

then handle WM_NOTIFY ( see http://nsis.svn.sourceforge.net/view...29&view=markup (search for EN_LINK) )

I'm not sure if it's possible to do with the current nsDialog, can't remember exactly how it handles WM_NOTIFY


Anders, thanks for your help.

I just realized how much you could customize a License page, this is really great and pretty much easier than to create an entirely custom page from CreateControl.

One last question for you and I'll be all set : I can't seem to set two different values (one for each License page) for the MUI_TEXT_LICENSE_TITLE define. As soon as I set it, it is displayed in both license pages. It is the only define that behaves this way. See code here :

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; Show first default License page
!insertmacro MUI_PAGE_LICENSE 1.rtf

; Code to modify our custom license page
!define MUI_LICENSEPAGE_TEXT_TOP ""
!define MUI_LICENSEPAGE_TEXT_BOTTOM ""
!define MUI_LICENSEPAGE_BUTTON "Next"
!define MUI_TEXT_LICENSE_SUBTITLE ""
!define MUI_TEXT_LICENSE_TITLE "Something"
LicenseText " "
!insertmacro MUI_PAGE_LICENSE 1.rtf
!insertmacro MUI_PAGE_FINISH

The first license page is displayed with all the default text, except for the "Something" string appearing instead of the default "License Agreement" string.

Bug or expected behavior ?


!define MUI_PAGE_HEADER_TEXT "foo"
!define MUI_PAGE_HEADER_SUBTEXT "bar"
!insertmacro MUI_PAGE_LICENSE "${__FILE__}"

OR you can use a show callback function and call the MUI_HEADER_TEXT macro


This is excellent!

Thank you very much Anders, you have been very helpful.