Old 29th October 2012, 18:47   #1
sss123next
Junior Member
 
Join Date: Oct 2012
Posts: 28
insert clickable link inside checkbox and label text

Hi all, first of all - i am new here, and if my question is from faq or similar please point me to right direction.
i need to insert clickable link in text on checkbox, i already read docs, searched wiki and forum, and find nothing except some suggestions to edit resulting installer with resource hacker, i have dynamic custom pages via nsdialogs and as i understand resource hacker is not solution here because before installer start dialogs content are unknown, i have an idea to use few controls for this, checkbox without text, few labels and link, but here is another problem, how i can calculate size of this controls properly for good appearance on all dpi's ?
sss123next is offline   Reply With Quote
Old 29th October 2012, 21:38   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,100
You can use dialog units when you create nsDialog controls...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th October 2012, 21:43   #3
sss123next
Junior Member
 
Join Date: Oct 2012
Posts: 28
what difference between units and percents ?
sss123next is offline   Reply With Quote
Old 29th October 2012, 22:23   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,100
Dialog units are based on the size of the font

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th October 2012, 22:32   #5
sss123next
Junior Member
 
Join Date: Oct 2012
Posts: 28
thx for info !
sss123next is offline   Reply With Quote
Old 30th October 2012, 05:52   #6
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
The license page also supports link mid-text. And a checkbox at the bottom.
MSG is offline   Reply With Quote
Old 31st October 2012, 12:52   #7
sss123next
Junior Member
 
Join Date: Oct 2012
Posts: 28
i have made few tests with units and percents and have problems on different dpi, on large dpi not enough space for text in label, so i can't create "label link label" in line for all dpi's, is any solution for this exists ?

P.S. i need it on custom pages, not on license page
sss123next is offline   Reply With Quote
Old 10th November 2012, 23:01   #8
sss123next
Junior Member
 
Join Date: Oct 2012
Posts: 28
i have found http://dxr.mozilla.org/mozilla-centr.../stub.nsi.html this, in code i see GetTextExtent, but can't find in which plugin it defined..
sss123next is offline   Reply With Quote
Old 11th November 2012, 08:24   #9
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
If it were a plugin, it would be called with pluginname::GetTextExtent. It's however called by ${GetTextExtent}, which is a define. So what you probably need is a header file (nsh). I can't find the !define of gettextext anywhere either, so you'll have to ask whoever created that installer.
MSG is offline   Reply With Quote
Old 11th November 2012, 21:30   #10
sss123next
Junior Member
 
Join Date: Oct 2012
Posts: 28
thx for hint, i have found it in mozilla-central hg repo via grep., if someone needed, i can post code or links
sss123next is offline   Reply With Quote
Old 12th November 2012, 03:34   #11
sss123next
Junior Member
 
Join Date: Oct 2012
Posts: 28
i still not solved this...
currently i have following code

code:
StrCpy $cur_node3 "1"
nsisXML::select "/root/offer[$cur_node]/layout/checkbox[$cur_node2]/label[$cur_node3]"
${While} $1 != 0
nsisXML::getAttribute "link"
StrLen $R0 $3
${If} $R0 != 0
MessageBox MB_OK "link: $3"
${NSD_CreateLink} $x $y% $5 $h% "$7"
${Else}
${NSD_CreateLabel} $x $y% $5 $h% "$7"
${EndIf}
intop $x $x + $5
!insertmacro INCREMENT $cur_node3
nsisXML::select "/root/offer[$cur_node]/layout/checkbox[$cur_node2]/label[$cur_node3]"
${EndWhile}



here i have following problems:
1. http://forums.winamp.com/showthread.php?t=351840
2. currently main window width unhandled, to handle it i need to know main window width and height, how can i get this ?

P.S. this is incomplete code, i have removed not related to position code, so IS wrong code in this condition, here is only positioning code and base cycle.

Last edited by sss123next; 12th November 2012 at 05:13.
sss123next is offline   Reply With Quote
Old 12th November 2012, 04:54   #12
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Please do not ask the same question twice - you already asked this question in a separate thread: http://forums.winamp.com/showthread.php?t=351840
MSG is offline   Reply With Quote
Old 12th November 2012, 05:13   #13
sss123next
Junior Member
 
Join Date: Oct 2012
Posts: 28
sorry, i see answer in my another thread, looks like it answer for both questions.
sss123next is offline   Reply With Quote
Old 12th November 2012, 11:59   #14
sss123next
Junior Member
 
Join Date: Oct 2012
Posts: 28
here is my solution

code:

nsisXML::getAttribute "x"
StrCpy $x $3
nsisXML::getAttribute "y"
StrCpy $y $3
nsisXML::getAttribute "w"
StrCpy $w $3
nsisXML::getAttribute "h"
StrCpy $h $3
${NSD_CreateLabel} $0% $0% 100% 100% ""
pop $hwnd
System::Call `*${stRECT} .R0`
System::Call `user32::GetClientRect(i $hwnd, i R0)`
System::Call `*$R0${stRECT} (, , .R7, .R8)`
System::Call `user32:estroyWindow(i $hwnd)`
intop $x $x * $R7
intop $x $x / 100
intop $y $y * $R8
intop $y $y / 100
intop $h $h * $R8
intop $h $h / 100
${NSD_CreateCheckbox} $x $y 3% $h ""
pop $hwnd
StrCpy $R0 "4" ;4%
intop $R0 $R0 * $R7
intop $R0 $R0 / 100
intop $x $x + $R0
nsisXML::getAttribute "checked"
${If} $3 == "true"
${NSD_Check} $hwnd
${EndIf}
StrCpy $cur_node3 "1"
nsisXML::select "/root/offer[$cur_node]/layout/checkbox[$cur_node2]/label[$cur_node3]"
${While} $1 != 0
nsisXML::getText
StrCpy $7 $3
SendMessage $hwndparent ${WM_GETFONT} 0 0 $R6
${StrRep} '$R9' '$7' '_' ' ' ;xml parser eat spaces, workaround
StrCpy $7 $R9
${GetTextExtent} "$7" $R6 $5 $6
nsisXML::getAttribute "link"
StrLen $R0 $3
${If} $R0 != 0
${NSD_CreateLink} $x $y $5 $h "$7"
${Else}
${NSD_CreateLabel} $x $y $5 $h "$7"
${EndIf}
intop $x $x + $5
!insertmacro INCREMENT $cur_node3
nsisXML::select "/root/offer[$cur_node]/layout/checkbox[$cur_node2]/label[$cur_node3]"
${EndWhile}


sss123next is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
custom page, nsdialogs, nsis

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