Archive: 3 bugs with MUI 2.0


3 bugs with MUI 2.0
  Hi,

before stating the problems here is the code (Ver 2.30, rtl.bmp is attached, I'm using Win XP SP2):



>!include "MUI.nsh"

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "rtl.bmp"
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
!define MUI_HEADERIMAGE_BITMAP_RTL "rtl.bmp"
!define MUI_HEADERIMAGE_BITMAP_RTL_NOSTRETCH
!define MUI_HEADERIMAGE_UNBITMAP "rtl.bmp"
!define MUI_HEADERIMAGE_UNBITMAP_NOSTRETCH
!define MUI_HEADERIMAGE_UNBITMAP_RTL "rtl.bmp"
!define MUI_HEADERIMAGE_UNBITMAP_RTL_NOSTRETCH
!define MUI_ABORTWARNING

OutFile "demo.exe"

>InstallDir "$PROGRAMFILES\Demo"

>!insertmacro MUI_LANGUAGE "English"
>!insertmacro MUI_LANGUAGE "Arabic"

>Name "Demo"

>Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

;!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

;!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

Section "Demo"

SetOutPath $INSTDIR

; Put file there
WriteUninstaller "$INSTDIR\uninstall.exe"

>SectionEnd

Section "Start Menu Shortcuts"

CreateDirectory "$SMPROGRAMS\Demo"
CreateShortCut "$SMPROGRAMS\Demo\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0

SectionEnd

Section "Uninstall"

RMDir /r "$SMPROGRAMS\Demo"
RMDir /r "$INSTDIR"

>SectionEnd
>
Now to the problems:

1 - Uninstall bmp image is not shown when uninstalling.
2 - When selecting arabic language the header image is not shown fully (just part of it). I have reported this in:
http://forums.winamp.com/showthread....hreadid=277846

3 - Remove the comments for MUI_PAGE_WELCOME & MUI_UNPAGE_WELCOME and the compiler will report these errors:




Error
: resolving uninstall function "un.Nsis2Io" in function "un.mui.WelcomePre_43.7.5.9"
>Note: uninstall functions must begin with "un.", and install functions must not
Error- aborting creation process
>
Please help. thanks

Re: 3 bugs with MUI 2.0
 

Originally posted by abu_abdulla
Hi,

before stating the problems here is the code (Ver 2.30, rtl.bmp is attached, I'm using Win XP SP2):




>!include "MUI.nsh"
Please help. thanks
If you use MUI2 you should change your code to:


nsh 

>

Thanks for the comment. I did this but the image now is not shown at all. In addition the language choice frame is not displayed also.

The code again since [PHP] tag removes '\'



!include "MUI2.nsh"

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "rtl.bmp"
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
!define MUI_HEADERIMAGE_BITMAP_RTL "rtl.bmp"
!define MUI_HEADERIMAGE_BITMAP_RTL_NOSTRETCH
!define MUI_HEADERIMAGE_UNBITMAP "rtl.bmp"
!define MUI_HEADERIMAGE_UNBITMAP_NOSTRETCH
!define MUI_HEADERIMAGE_UNBITMAP_RTL "rtl.bmp"
!define MUI_HEADERIMAGE_UNBITMAP_RTL_NOSTRETCH
!define MUI_ABORTWARNING

OutFile "demo.exe"

InstallDir "$PROGRAMFILES\Demo"

!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Arabic"

Name "Demo"

Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

;!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

;!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

Section "Demo"

SetOutPath $INSTDIR

; Put file there
WriteUninstaller "$INSTDIR\uninstall.exe"

SectionEnd

Section "Start Menu Shortcuts"

CreateDirectory "$SMPROGRAMS\Demo"
CreateShortCut "$SMPROGRAMS\Demo\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0

SectionEnd

Section "Uninstall"

RMDir /r "$SMPROGRAMS\Demo"
RMDir /r "$INSTDIR"

SectionEnd


Does this happens only to me? or is there anything missing.


You have inserted the page macros after the language macros. The language macros must be inserted after the page macros.


Thanks so much kichik for your comment. Problems 1 & 3 are solved by this.
On the other hand, problem 2 is still which is in case of selecting Arabic language (RTL language) the header image is not shown fully (just part of it) although I'm using MUI_HEADERIMAGE_BITMAP_RTL_NOSTRETCH.

This is the code again after the modification (image is attached in the first post):



!include "MUI.nsh"

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "rtl.bmp"
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
!define MUI_HEADERIMAGE_BITMAP_RTL "rtl.bmp"
!define MUI_HEADERIMAGE_BITMAP_RTL_NOSTRETCH
!define MUI_HEADERIMAGE_UNBITMAP "rtl.bmp"
!define MUI_HEADERIMAGE_UNBITMAP_NOSTRETCH
!define MUI_HEADERIMAGE_UNBITMAP_RTL "rtl.bmp"
!define MUI_HEADERIMAGE_UNBITMAP_RTL_NOSTRETCH
!define MUI_ABORTWARNING

OutFile "demo.exe"

InstallDir "$PROGRAMFILES\Demo"

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Arabic"

Name "Demo"

Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

Section "Demo"

SetOutPath $INSTDIR

; Put file there
WriteUninstaller "$INSTDIR\uninstall.exe"

SectionEnd

Section "Start Menu Shortcuts"

CreateDirectory "$SMPROGRAMS\Demo"
CreateShortCut "$SMPROGRAMS\Demo\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0

SectionEnd

Section "Uninstall"

RMDir /r "$SMPROGRAMS\Demo"
RMDir /r "$INSTDIR"

SectionEnd


Still can't reproduce. Include screenshots and rtl.bmp as requested in the original thread.


screen shot is attached

rtl.bmp:
http://forums.winamp.com/attachment.php?s=&postid=2242144


That's exactly what's supposed to happen. The header image shouldn't be that large, it should be 150x57. When you use RTL, those 150x57 will start on the right side and so your overflow will go over the right edge of the screen.

To have the image cover the entire header, you'll have to modify the UI. Edit Contrib\UIs\modern_headerbmp.exe with Resource Hacker and move control #1046 to wherever you want the header image to be (when it's RTL, it'll just put the image on the exact opposite side). Then use MUI_UI_HEADERIMAGE to tell the MUI to load your UI instead of modern_headerbmp.exe.