Old 9th September 2010, 09:59   #1
manasi1128
Junior Member
 
Join Date: Sep 2010
Posts: 19
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.....
manasi1128 is offline   Reply With Quote
Old 9th September 2010, 10:24   #2
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Seems that this is not supported in License page:
http://forums.winamp.com/showthread.php?t=291304
jpderuiter is offline   Reply With Quote
Old 10th September 2010, 17:51   #3
Wizou
Senior Member
 
Join Date: Aug 2007
Location: Paris, France
Posts: 304
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 ?
Wizou is offline   Reply With Quote
Old 16th September 2010, 04:40   #4
manasi1128
Junior Member
 
Join Date: Sep 2010
Posts: 19
I'm using custom dialogs
manasi1128 is offline   Reply With Quote
Old 16th September 2010, 06:56   #5
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
http://forums.winamp.com/showthread.php?t=290291
jpderuiter is offline   Reply With Quote
Old 17th September 2010, 09:07   #6
manasi1128
Junior Member
 
Join Date: Sep 2010
Posts: 19
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?
manasi1128 is offline   Reply With Quote
Old 17th September 2010, 09:38   #7
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
http://nsis.sourceforge.net/Docs/nsD...l#ref-onnotify
jpderuiter is offline   Reply With Quote
Old 17th September 2010, 09:44   #8
manasi1128
Junior Member
 
Join Date: Sep 2010
Posts: 19
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"
......................
.........................
manasi1128 is offline   Reply With Quote
Old 17th September 2010, 09:51   #9
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
What is 'click' in the OnNotify call?
You should use a variable with the FunctionAddress of the Callback function there.
jpderuiter is offline   Reply With Quote
Old 17th September 2010, 10:01   #10
manasi1128
Junior Member
 
Join Date: Sep 2010
Posts: 19
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...
manasi1128 is offline   Reply With Quote
Old 17th September 2010, 10:29   #11
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
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?
Animaether is offline   Reply With Quote
Old 17th September 2010, 10:44   #12
manasi1128
Junior Member
 
Join Date: Sep 2010
Posts: 19
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
manasi1128 is offline   Reply With Quote
Old 17th September 2010, 11:16   #13
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
Quote:
Originally Posted by manasi1128 View Post
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
I'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:
http://nsis.sourceforge.net/ButtonEvent_plug-in
Animaether is offline   Reply With Quote
Old 17th September 2010, 15:39   #14
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
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:
PHP Code:
!addincludedir "."
!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_STATICEDGE0 0 100100''
  
Pop $myRichEdit

  
/* Automatically turn tect with protocol handlers into links */
  
SendMessage $myRichEdit ${EM_AUTOURLDETECT1 0
  
/* Make the RichEdit control report events related to links */
  
SendMessage $myRichEdit ${EM_SETEVENTMASK${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 $/* The message being sent.  There's several (mouse over richedit, mouse over link, etc.).  We only care about one. */
  
Pop $/* Data within the message, for later parsing. */
  
  /* We only care about events related to hyperlinks. */
  
${If} $= ${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} $= ${WM_LBUTTONUP}
      
/* Calculate number of characters from End - Start ranges */
      
IntOp $$- $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$$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 
Probably still doing a few things wrong, but it seems to work anyway.

Edit 2: LoadRTF.nsh is from...
http://forums.winamp.com/showthread.php?threadid=288129
...gotta remember to stick that into a wiki page later today >_<
Animaether is offline   Reply With Quote
Old 17th September 2010, 18:41   #15
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
argh. that wasn't the 'edit' button.

LoadRTF.nsh is now from http://nsis.sourceforge.net/LoadRTF
Animaether is offline   Reply With Quote
Old 17th September 2010, 20:15   #16
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
Looks like there's an intermittent crash from my lack of space for the terminating null char (err.. I think).

old
PHP Code:
      /* Calculate number of characters from End - Start ranges */
      
IntOp $$- $6
      
/* Allocate a buffer for the text.  No StrAlloc in the released System plugin... */
      
System::Call "*(&t$0) i.R0" 
new
PHP Code:
      /* Calculate number of characters from End - Start ranges */
      
IntOp $$- $6
      
/* Add one */
      
IntOp $$1
      
/* Allocate a buffer for the text.  No StrAlloc in the released System plugin... */
      
System::Call "*(&t$0) i.R0" 
Animaether is offline   Reply With Quote
Old 20th September 2010, 05:02   #17
manasi1128
Junior Member
 
Join Date: Sep 2010
Posts: 19
thanx a tonne dude u made my day!!!!......dat worked now atleast i can capture the onnotify event....
manasi1128 is offline   Reply With Quote
Old 20th September 2010, 05:19   #18
manasi1128
Junior Member
 
Join Date: Sep 2010
Posts: 19
n dis link was veryy helpful for opening the url in new window...
http://nsis.sourceforge.net/Open_lin...browser_window
manasi1128 is offline   Reply With Quote
Old 20th September 2010, 07:17   #19
manasi1128
Junior Member
 
Join Date: Sep 2010
Posts: 19
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.....
manasi1128 is offline   Reply With Quote
Old 20th September 2010, 13:53   #20
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
Quote:
Originally Posted by manasi1128 View Post
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.....
I... 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.
http://nsis.sourceforge.net/NsWeb_plug-in
Might be able to glean from the source what code is used and use System plugin calls instead, but no real need.. the plugin is fairly small.

But, again, if you really wanted to.. there's an EM_FINDTEXT that you could use as a quasi-anchored link (i.e. you click the link, it searches for the correct subsection with the same string, perhaps, further down the document.. would have to be unique, of course) and gives you the beginning/ending char index... then there's EM_EXSETSEL which you can use to select that range (or just select the position at the beginning of that range), combined with EM_SCROLLCARET which scrolls the caret (which should now be at the selecton) into view.
( there's also an EM_SETSCROLLPOS, but that takes pixels and I haven't the foggiest how one might get from char index to client-doc pixel coords there. )

But, once more.. Browser control might be better for your exact purposes? ( though the question about links in RTFs has come up several times before, so they'll always have this thread )
Animaether is offline   Reply With Quote
Old 21st September 2010, 04:37   #21
manasi1128
Junior Member
 
Join Date: Sep 2010
Posts: 19
thnx dude......now gotta do R&D on dis stuff........
manasi1128 is offline   Reply With Quote
Old 21st September 2010, 05:21   #22
manasi1128
Junior Member
 
Join Date: Sep 2010
Posts: 19
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.....
manasi1128 is offline   Reply With Quote
Old 21st September 2010, 12:16   #23
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
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
Animaether 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