Archive: About Link Field (don't want entire text show up as link)


About Link Field (don't want entire text show up as link)
Hi there,

Link field is great. But how do I use a single link field to achieve a simple task like this:

Click here to go to my homepage.

If I use a single link field and specifying the entire sentence as "text", the whole sentence turns into link. But I only want "here" to be a link.

Do I have to make 3 fields for this: a "Click" text field, a "here" link field, and another text field for the rest of the text? But as the sentence gets longer, text wrapping becomes challenging.

I'm sure this is a common scenario. How do you guys do this?

Thanks,
lyz


Hello.

Here is one option. I assume you are getting your link on the Finish Page with this:


!define MUI_FINISHPAGE_LINK "Click here to go to my homepage"
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.blabla.com"

That being said, the ioSpecial.ini is being populated with this:

[Field 4]
Type=Link
Text=Click here to go to my homepage
Left=120
Right=315
Top=175
Bottom=185
State=http://www.blabla.com

So...you could simply add a MUI_PAGE_CUSTOMFUNCTION_PRE function define right before your Finish page macro, like this:

!define MUI_PAGE_CUSTOMFUNCTION_PRE "FinishPre"
!insertmacro MUI_PAGE_FINISH

And then add the function itself like this:

Function FinishPre
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "NumFields" "5" ;need to add 1 (4+1=5) to what value is already in there

!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Type" "Label" ;this will change your link (field number from above) to just a label

!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Type" "Link"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Text" "HERE"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Left" "130" ;Guessing here...
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Right" "139" ;Guessing here too...
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Top" "175"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Bottom" "185"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "State" "http://www.blabla.com"
; the above 7 lines should place the link HERE right on top of the label
; you made above. You will have to test your right/left settings
FunctionEnd


Hope this helps!

Thanks Jnuw for your great reply. I thought about that too. I really hoped NSIS can let us to define which region of the text to show as link for a link field. I should probably add an RFE for this. :)

Thanks again,
lyz


it should be possible(but alot of work) to to get this working as a single control using the syslink class ( http://msdn.microsoft.com/library/de...slinkovrvw.asp ) but it only works on 2000 and later (xp and 2000 are not even the same, so you would need two different implementations) using either alot of system calls or a custom plugin