Old 19th April 2010, 01:18   #1
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Shanghai, China
Posts: 207
Exclamation Problem of NSD_CreateIPAddress.nsh

PHP Code:
!include "MUI2.nsh"
!include "CreateIPaddress.nsh"

Name "Program"
OutFile Program.exe
InstallDir $Temp

!insertmacro MUI_PAGE_DIRECTORY
Page custom CreatePage
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

Section Install

SectionEnd

Function CreatePage
    
!insertmacro MUI_HEADER_TEXT "Set IP address" "Please input the IP address you want to set"
    
nsDialogs::Create 1018
    Pop 
$0
    
${If} $== error
        Abort
    
${EndIf}
    ${
NSD_CreateLabel0u 2u 64u 8u "Input IP address:"
    
${NSD_CreateIPaddress70u 0u 80u 12u ""
    
nsDialogs::Show
FunctionEnd 
On the custom page, click back, then the font of directory selection page turns large:
Click image for larger version

Name:	pic1.png
Views:	524
Size:	16.4 KB
ID:	46797
Click next, the font of the custom page also changes, not the former one.
Click image for larger version

Name:	pic2.png
Views:	614
Size:	11.8 KB
ID:	46798

Last edited by jiake; 19th April 2010 at 03:36.
jiake is offline   Reply With Quote
Old 19th April 2010, 11:35   #2
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
huh.. never noticed that before - but confirmed anyway (no idea if it's related to installing XP SP3). That's a weird bug.

'fraid that might (depending on whether a cause can be found and addressed) leave you with the alternative options of creating 4 text controls, or using 1 text control and validating input, etc.

Edit: looks like this is a known problem with SysIPAddress32. It disposes of the font that's used to create it, originally.
Animaether is offline   Reply With Quote
Old 19th April 2010, 11:43   #3
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
okay, solved thusly... create a new font and set that on the control before display. E.g.

PHP Code:
    ${NSD_CreateLabel0u 0 2010"Input IP address:"
        
Pop $0
    
${NSD_CreateIPaddress200 8010"127.0.0.1"
        
Pop $1
    CreateFont $R0 
"$(^Font)" "$(^FontSize)"
    
SendMessage $${WM_SETFONT$R0 1 
I'll adjust the header in the wiki after grabbing the font info elegantly somewhere.
Edit: adjusted post with the proper font langstrings.
Animaether is offline   Reply With Quote
Old 19th April 2010, 12:16   #4
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
Header file in the wiki ( http://nsis.sourceforge.net/NsDialogs_CreateIPaddress ) is now updated.

End-users: download the new version and your scripts using NSD_CreateIPAddress should continue to work just fine - and the installer font should no longer corrupt.

Developers: nsDialogs' framework doesn't allow for any particular post-fixing of its defines. The original define is renamed to NSD_CreateIPAddressControl. The original NSD_CreateIPAddress define is then re-defined to insert a macro which calls the renamed original and applies the font corruption fix and then pushes the control's handle back onto the stack.
Animaether is offline   Reply With Quote
Old 20th April 2010, 01:21   #5
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Shanghai, China
Posts: 207
I tried the fixed header file, it works well. Neither click back or the next button, the font is right.
jiake is offline   Reply With Quote
Old 20th April 2010, 01:34   #6
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
excellent - glad it's fixed with that
Animaether is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

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