The license file does not open the hyperlinks!!!
The license.rtf file does not open the hyperlinks....after it gets loaded in the installer ......any idea like wat might b the possible reason.....
Archive: The license file does not open the hyperlinks!!!
The license file does not open the hyperlinks!!!
The license.rtf file does not open the hyperlinks....after it gets loaded in the installer ......any idea like wat might b the possible reason.....
Seems that this is not supported in License page:
http://forums.winamp.com/showthread.php?t=291304
Hyperlinks are supported in License page.
However, make sure you put the full URL visible in the text. Not a hyperlink hidden behind another text.
If it still doesn't work, are you using Unicode NSIS or custom dialog resources ?
I'm using custom dialogs
I went thru the above url earlier also but not gettin the part of handling WM_NOTIFY event......tried a lot but cud'nt settle down on anything....instead got more confused...can anyone display an example?
yup tried dat....but dont know why it is not working...following is the code..plz let me know if any thing is wrong
.................
...............
File /oname=$PLUGINSDIR\amex-license$RANDNUM.rtf ..\cpp\bin\amex-license.rtf #Manasi--Replaced $TEMP with $PLUGINSDIR----Fix for Bug #8928
nsDialogs::CreateControl /NOUNLOAD "RichEdit20A" ${ES_READONLY}|${WS_VISIBLE}|${WS_CHILD}|${WS_TABSTOP}|${WS_VSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN} ${WS_EX_STATICEDGE} 0 80 100% 130u ''
Pop $LICENSE
FileOpen $4 "$PLUGINSDIR\amex-license$RANDNUM.rtf" r #Manasi--Replaced $TEMP with $PLUGINSDIR----Fix for Bug #8928.
StrCpy $0 $LICENSE
SendMessage $LICENSE ${EM_EXLIMITTEXT}|${EM_AUTOURLDETECT}|${EM_SETEVENTMASK}|${ENM_LINK} 0 0x7fffffff
; set EM_AUTOURLDETECT to detect URL automatically
;Do not detect the links
SendMessage $LICENSE 1115 1 0
nsDialogs::OnNotify /NOUNLOAD $LICENSE click
System::Get /NoUnload "(i, i .R0, i .R1, i .R2) iss"
Pop $2
System::Call /NoUnload "*(i 0, i 0, k r2) i .r3"
......................
.........................
What is 'click' in the OnNotify call?
You should use a variable with the FunctionAddress of the Callback function there.
click is a function to be called on WM_NOTIFY event
I tried GetFunctionAddress $0 Click before the onnotify call.....but it results in blank richtext.......
not getting any example on net where the On_botify eevent is handled... :cry:
When you use EM_SETEVENTMASK to set the ENM_LINK event on the RichEdit control, that control will send an EN_LINK notification via WM_NOTIFY to the control's -parent-.. in this case, the inner dialog used by nsDialogs.
Unfortunately, setting up an NSD_OnNotify on that hwnd doesn't seem to work.. the function supplied is never called, at least.. but maybe I'm doing something stupid.
Using the WndSubClass plugin to catch events on it instead does work, and I can see it grabbing the WM_NOTIFY and detecting clicks (different lparam), but the actual notification sent, in wparam, has a value of 1200.. rather than that of EN_LINK (1803). So I'm not sure what's going on there.
Edit: Ah - I had a typo somewhere. The EN_LINK does work off of the RichEdit itself - but you'll need to poke at the ENLINK (see below) to figure out whether the user clicked the link or just moused over the thing. Funs.
Then again.. if you then read further into how this is then handled further... the lparam is a pointer to an ENLINK structure. That ENLINK structure has an MNHDR and a bunch of information... none of which are particularly directly useful (i.e. none contain the link clicked as a nice string). Instead, you get to poke about at the charrange structure instead... getting the start/end from that. Then you have to poke at the RichEdit control once again to get the actual text at that start/end range before you have something you could use to open a browser with.
You'd be much easier off just using the built-in license page if you must have the clickable links inside the text... do you have a particular reason for not using a custom one instead?
actually the license page is customised to have print and save button also some other additional stuff goes on dat dialog so the the custom dialog feasible here
Originally posted by manasi1128I'm guessing you mean that your custom page has an extra print and save button, rather than the license page. However, you could modify the actual license page using a resource editor, and then work with those buttons. The ButtonEvent plugin is an older example of doing something like that:
actually the license page is customised to have print and save button also some other additional stuff goes on dat dialog so the the custom dialog feasible here
Well.. I've got it working with a custom page anyway.
Edit: Resolved the getting of the text thing.. obviously I need to specify the number of characters I want to retrieve from the buffer specified. Whoops.
Here 'tis in all its glory:
!addincludedir "."Probably still doing a few things wrong, but it seems to work anyway.
!addplugindir "."
!include "nsDialogs.nsh"
!include "LogicLib.nsh"
!include "WinMessages.nsh"
!include "LoadRTF.nsh"
OutFile "$%temp%\temp.exe"
Section
SectionEnd
!define /math EM_AUTOURLDETECT ${WM_USER} + 91
!define /math EM_SETEVENTMASK ${WM_USER} + 69
!define /math EM_GETTEXTRANGE ${WM_USER} + 75
!define ENM_LINK 0x04000000
!define EN_LINK 0x070B
Page Custom customPage
Var dialog
Var hwnd
Var null
Var myRichEdit
Function customPage
nsDialogs::Create 1018
Pop $dialog
${If} $dialog == error
Abort
${EndIf}
nsDialogs::CreateControl "RichEdit20A" ${ES_READONLY}|${WS_VISIBLE}|${WS_CHILD}|${WS_TABSTOP}|${WS_VSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN} ${WS_EX_STATICEDGE} 0 0 100% 100% ''
Pop $myRichEdit
/* Automatically turn tect with protocol handlers into links */
SendMessage $myRichEdit ${EM_AUTOURLDETECT} 1 0
/* Make the RichEdit control report events related to links */
SendMessage $myRichEdit ${EM_SETEVENTMASK} 0 ${ENM_LINK}
/* Set up a callback for WM_NOTIFY messages */
${NSD_OnNotify} $myRichEdit myNotify
/* Load an RTF file into the control */
${LoadRTF} "test.rtf" $myRichEdit
nsDialogs::Show
FunctionEnd
Function myNotify
Pop $hwnd /* Calling hwnd - should be our richedit. Check against if you use more than 1 on a page. */
Pop $1 /* The message being sent. There's several (mouse over richedit, mouse over link, etc.). We only care about one. */
Pop $2 /* Data within the message, for later parsing. */
/* We only care about events related to hyperlinks. */
${If} $1 = ${EN_LINK}
/* Get the data */
System::Call "*$2(i.r0, i.r1, i.r2, i.r3, i.r4, i.r5, i.r6, i.r7)"
/* For debugging and such, sets the 3 important message bits in the Branding text area
GetDlgItem $0 $HWNDPARENT 1028
SendMessage $0 ${WM_SETTEXT} 0 "STR:$3|$4|$5" */
${If} $3 = ${WM_LBUTTONUP}
/* Calculate number of characters from End - Start ranges */
IntOp $0 $7 - $6
/* Allocate a buffer for the text. No StrAlloc in the released System plugin... */
System::Call "*(&t$0) i.R0"
/* Create a new TEXTRANGE structure (chrg CHARRANGE, lpstrText LPSTR) */
System::Call "*(i$6, i$7, i$R0) i.r1"
/* Call EM_GETTEXTRANGE */
SendMessage $myRichEdit ${EM_GETTEXTRANGE} 0 $1 $2
/* Get text out of buffer.. */
System::Call "*$R0(&t$0.r2)"
MessageBox MB_OK "Link text: $2"
/* Free memory */
System::Free $1
System::Free $0
${EndIf}
${EndIf}
FunctionEnd
>
argh. that wasn't the 'edit' button.
LoadRTF.nsh is now from http://nsis.sourceforge.net/LoadRTF
Looks like there's an intermittent crash from my lack of space for the terminating null char (err.. I think).
old
/* Calculate number of characters from End - Start ranges */
IntOp $0 $7 - $6
/* Allocate a buffer for the text. No StrAlloc in the released System plugin... */
System::Call "*(&t$0) i.R0"
new
/* Calculate number of characters from End - Start ranges */
IntOp $0 $7 - $6
/* Add one */
IntOp $0 $0 + 1
/* Allocate a buffer for the text. No StrAlloc in the released System plugin... */
System::Call "*(&t$0) i.R0"
thanx a tonne dude u made my day!!!!......dat worked now atleast i can capture the onnotify event.... :)
n dis link was veryy helpful for opening the url in new window...
http://nsis.sourceforge.net/Open_lin...browser_window
one last quastion...den i'm done with the license custom page stuff..... :)
the rtf file that i'm loading in the richtext control has table of contents in it......so is it possible to acheive that indexing after loading the file in installer??...as in 'go to Top' etc.....
Originally posted by manasi1128I... guess you could if you really wanted to. I'm starting to think (once again) that a Browser control would be more appropriate here.. then you can just stick HTML in there with all its inherent goodness.
the rtf file that i'm loading in the richtext control has table of contents in it......so is it possible to acheive that indexing after loading the file in installer??...as in 'go to Top' etc.....
thnx dude......now gotta do R&D on dis stuff........
in the hyperlink case the autodetecturl message makes the link clickable.....wat should i do in dis case....i mean the the table of contents is not clickable.....
well that's another reason a browser control might be better ;)
Although you can set a link on a standard bit of text, the RichEdit control doesn't appear to recognize them straight out of OpenOffice.org re-saved through Wordpad, and inserts the URL behind the linked text.. I think that requires a change to RichEdit 4.1). There's some more SendMessage craziness that -might- set a link on a given selection, but that drops you back to specifying which text should be linked in your installer code.. and I have no idea if that -would- work (haven't tested.. EM_GETCHARFORMAT SF_SELECTED / CFE_LINK | CFM_LINK / EM_SETCHARFORMAT SF_SELECTED ).
One completely hacky way would be to just stick http:// in front of the table-of-content items and make that a tiny-sized font (I think the smallest size you can set directly is 1) and hope nobody thinks that silly ;) Although you could combine that with the above by finding all instances of http:// and hide them entirely through WM_SETCHARFORMAT.
Really, though, Rich Text Files aren't meant for this sort of thing.. hyperlinks were hacked on by MSFT by popular demand.. but you shouldn't expect HTML-like behavior from an RTF :)