Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 15th September 2006, 08:21   #1
nvit
Junior Member
 
nvit's Avatar
 
Join Date: Jun 2006
Location: Vinnitsa, Ukraine
Posts: 22
Question How to skip MUI_PAGE_DIRECTORY dialog?

In case of upgrade from older to newer version
I would like to give a user option to "quick" upgrade into the same folder with no directory dialog showing.

How to prevent of appearing "Directory dialog" if, for example, $r0 = "QUICK_INSTALL"?

In other case (first install) "Directory dialog" is need, of cause. So I can't globally exclude
!insertmacro MUI_PAGE_DIRECTORY
But I have no idea how to manage this dialog
nvit is offline   Reply With Quote
Old 15th September 2006, 09:12   #2
saschagottfried
Member
 
Join Date: Aug 2006
Location: Germany
Posts: 54
; this is an example for page_startmenu, but the same
; applies for the directory page

; for if,else usage ...
!include logiclib.nsh

;
!define MUI_PAGE_CUSTOMFUNCTION_PRE StartmenuPage_Show
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup

Function StartmenuPage_Show

${If} $InstallType = 3
Abort
${EndIf}

FunctionEnd

see "Customize Modern UI Functions" in MUI help (chapter 2.5) for explanation of PRE, SHOW, LEAVE functions.

excerpt:

;These defines should be set before inserting a page macro.

MUI_PAGE_CUSTOMFUNCTION_PRE function
MUI_PAGE_CUSTOMFUNCTION_SHOW function
MUI_PAGE_CUSTOMFUNCTION_LEAVE function

As shown above you use "Abort" in PRE-function to prevent it from appearing. In a Leave function "abort" is used to return to a page - useful for buttons clicks. The usage is "context-sensitive". Those functions and callback function as well are very powerful tools. Good luck!

An appetizer - the code below shows the page with directory read from registry but the browse button and the directory textfield are disabled and the standard page text is modified with a user-defined text telling the user that in installation was already found and so on....


!define MUI_PAGE_CUSTOMFUNCTION_SHOW Directory_Show
!insertmacro MUI_PAGE_DIRECTORY

Function Directory_Show

;exactly the example from user manual - 4.9.14.6
FindWindow $R1 "#32770" "" $HWNDPARENT

ReadRegStr $yourVar ${InstallRegKey}
;dumpstate::debug
StrCmp $yourVar "" FullDirectoryPage PartialDirectoryPage

PartialDirectoryPage:
## Change Directory Text
GetDlgItem $R0 $R1 1006
SendMessage $R0 ${WM_SETTEXT} 0 "STR:YourText"
EnableWindow $R0 1
#disable dir text
GetDlgItem $R2 $R1 1019
SendMessage $R2 ${WM_SETTEXT} 0 "STR:$yourVar"
EnableWindow $R2 0
#disable "browse button"
GetDlgItem $R2 $R1 1001
EnableWindow $R2 0
Return

FullDirectoryPage:
FunctionEnd
saschagottfried is offline   Reply With Quote
Old 15th September 2006, 11:39   #3
nvit
Junior Member
 
nvit's Avatar
 
Join Date: Jun 2006
Location: Vinnitsa, Ukraine
Posts: 22
saschagottfried!

Lotta thanx for your advices!
1. MUI_PAGE_CUSTOMFUNCTION_PRE is very good feature really!
2. Thank you for mention of "logiclib.nsh". Up today I didn't know about this good stuff.
nvit is offline   Reply With Quote
Reply
Go Back   Winamp 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