Archive: insert clickable link inside checkbox and label text


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 ?


You can use dialog units when you create nsDialog controls...


what difference between units and percents ?


Dialog units are based on the size of the font


thx for info !


The license page also supports link mid-text. And a checkbox at the bottom.


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


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..


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.


thx for hint, i have found it in mozilla-central hg repo via grep., if someone needed, i can post code or links


i still not solved this...
currently i have following 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.

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


sorry, i see answer in my another thread, looks like it answer for both questions.


here is my solution


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::DestroyWindow(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}