Underline All InstallOptions Links

From NSIS Wiki
Jump to navigationJump to search

Description

Required: InstallOptions plug-in and LogicLib.

Given the file name of an InstallOptions ini file, scan all fields and set all "link" type fields to an underlined font.

Function Call

Push "filename.ini"
Call IOUnderline

Function Code

Function IOUnderline
	; $0 - Name of INI
	; $1 - Number of fields
	; $2 - Counter
	; $3 - Type of current field
	; $4 - HWND of current field
	; $5 - Underlined font
 
	; get ini name
	Pop $0
	; get ini num fields
	!insertmacro MUI_INSTALLOPTIONS_READ $1 "$0" "Settings" "NumFields"
	; init loop counter
	IntOp $2 0 + 1
	; init underlined font
	CreateFont $5 "$(^Font)" "$(^FontSize)" "400" /UNDERLINE
 
	${While} $2 <= $1
		!insertmacro MUI_INSTALLOPTIONS_READ $3 "$0" "Field $2" "Type"
		${If} "link" == $3
			!insertmacro MUI_INSTALLOPTIONS_READ $4 "$0" "Field $2" "HWND"
			SendMessage $4 ${WM_SETFONT} $5 1
		${EndIf}
 
		IntOp $2 $2 + 1
	${EndWhile}
FunctionEnd