Fonts in Static Controls: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (SF: doesnt -> doesn't.)
m (Adding new author and category links.)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{PageAuthor|techkid}}
== Description ==
== Description ==
This code was developed with working on NSIS Update the Static Controls like Label can be Change to different fonts, size, and weights. When NSIS Update uses a function it make the label bold the script is striped down but show the functionality. Please note that ListView Controls doesn't update like it really should be no matter it not a static control but it works.
This code was developed with working on NSIS Update the Static Controls like Label can be Change to different fonts, size, and weights. When NSIS Update uses a function it make the label bold the script is striped down but show the functionality. Please note that ListView Controls doesn't update like it really should be no matter it not a static control but it works.
Line 47: Line 49:
</highlight-nsis>
</highlight-nsis>


 
[[Category:User Interface Functions]]
Page author: techkid

Latest revision as of 12:13, 24 June 2005

Author: techkid (talk, contrib)


Description

This code was developed with working on NSIS Update the Static Controls like Label can be Change to different fonts, size, and weights. When NSIS Update uses a function it make the label bold the script is striped down but show the functionality. Please note that ListView Controls doesn't update like it really should be no matter it not a static control but it works.

The Script

Below is a complete script to compile and run:

Name "Change Font"
OutFile "ChangeFont.exe"
Caption "Change Font"
ShowINSTDetails show
 
!include "${NSISDIR}\Include\WinMessages.nsh"
 
!macro NSISU_TASK_TEXT_BOLD CONTROL
  FindWindow $R4 "#32770" "" $HWNDPARENT
  GetDlgItem $R4 $R4 ${CONTROL}
  SendMessage $R4 ${WM_SETFONT} $R1 0
!macroEnd
 
!macro NSISU_TASK_TEXT_NORM CONTROL
  FindWindow $R4 "#32770" "" $HWNDPARENT
  GetDlgItem $R4 $R4 ${CONTROL}
  SendMessage $R4 ${WM_SETFONT} $R0 0
!macroEnd
 
Function CreateFonts
  CreateFont $R0 "Arial" "8" "0"
  CreateFont $R1 "Arial" "8" "600"
FunctionEnd
 
Section
 
  call CreateFonts
  MessageBox MB_YESNO "Would you like to make it bold?" IDYES 0 IDNO EXIT
    !insertmacro NSISU_TASK_TEXT_BOLD 1006
    !insertmacro NSISU_TASK_TEXT_BOLD 1016
    DetailPrint "Bold Text"
    DetailPrint "Font: Arial"
    DetailPrint "Size: 8pt"
    DetailPrint "Weight: 800"
    MessageBox MB_YESNO "Would you like to make it Normal?" IDYES 0 IDNO EXIT
    !insertmacro NSISU_TASK_TEXT_NORM 1006
    !insertmacro NSISU_TASK_TEXT_NORM 1016
  EXIT:
 
SectionEnd