Underline text in LogWindow: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library)
 
(Added more spacing to the code.)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{PageAuthor|Afrow UK}}
== Description ==
== Description ==
This function will underline text with a specified character (uses "=" as default)
This function will underline text with a specified character (uses "=" as default)
Line 6: Line 8:
== Usage ==
== Usage ==
<highlight-nsis>
<highlight-nsis>
Push [string] ;string to underline
  Push [string] ;string to underline
Call UnderlineText
  Call UnderlineText
</highlight-nsis>
</highlight-nsis>


Line 13: Line 15:
<highlight-nsis>
<highlight-nsis>
Function UnderlineText
Function UnderlineText
Exch $0
  Exch $0
Push $1
  Push $1
Push $2
  Push $2
Push $3
  Push $3
  DetailPrint "$0"
 
  StrLen $2 $0
  DetailPrint "$0"
  StrCpy $1 "=" #("=" is underline character)
 
loop:
  StrLen $2 $0
  StrCpy $1 "$1=" #underline text ("=" is underline character)
  StrCpy $1 "=" #("=" is underline character)
  StrLen $3 $1
 
  StrCmp $3 $2 done loop
  loop:
done:
  StrCpy $1 "$1=" #underline text ("=" is underline character)
  DetailPrint "$1"
  StrLen $3 $1
Pop $3
  StrCmp $3 $2 done loop
Pop $2
  done:
Pop $1
 
Pop $0
  DetailPrint "$1"
 
  Pop $3
  Pop $2
  Pop $1
  Pop $0
FunctionEnd
FunctionEnd
</highlight-nsis>
</highlight-nsis>
Line 37: Line 44:
-Stu
-Stu


Page author: Afrow UK
[[Category:User Interface Functions]]

Latest revision as of 10:52, 16 October 2005

Author: Afrow UK (talk, contrib)


Description

This function will underline text with a specified character (uses "=" as default) Use Fixedsys for the LogWindow font, so that each character is evenly spaced. (To set the LogWindow font to Fixedsys, use the function Change Log Window Font)

Usage

  Push [string] ;string to underline
  Call UnderlineText

The Function

Function UnderlineText
  Exch $0
  Push $1
  Push $2
  Push $3
 
  DetailPrint "$0"
 
  StrLen $2 $0
  StrCpy $1 "=" #("=" is underline character)
 
  loop:
  StrCpy $1 "$1=" #underline text ("=" is underline character)
  StrLen $3 $1
  StrCmp $3 $2 done loop
  done:
 
  DetailPrint "$1"
 
  Pop $3
  Pop $2
  Pop $1
  Pop $0
FunctionEnd

Originally wrote for my D-Day Stats Logger v1.00

-Stu