2017-10-28 8 views
0

InstallOptionsEx 유효성 검사에 대한 도움이 필요합니다. InstallOptions에 우리는 =이 통지 플래그를 사용하여 우리는 기능NSIS InstallOptionsEx Validate

ReadINIStr $0 "$PLUGINSDIR\test.ini" "Settings" "State" 
    StrCmp $0 0 validate ; Next button? 
    StrCmp $0 2 supportx ; "Install support for X"? 
    StrCmp $0 9 clearbtn ; "Clear" button? 
    StrCmp $0 11 droplist ; "Show|Hide" drop-list? 
    Abort ; Return to the page 

이 같은 somehting했다 그러나 InstallOptionsEx에서 그들은 새로운 방법에 찬성 멀리 그것으로했던 말.

Step 5: Validate the Output 
If you want to validate the input on the page, for example, you want to check whether the user has filled in a textbox, use the leave function of the Page command and Abort when the validation has failed: 
    Function ValidateCustom 

    ReadINIStr $R0 "$PLUGINSDIR\test.ini" "Field 1" "State" 
    StrCmp $0 "" 0 +3 
     MessageBox MB_ICONEXCLAMATION|MB_OK "Please enter your name." 
     Abort 

    FunctionEnd 

  Step 6: Return Value 
After you have called the DLL, InstallOptionsEx adds one string to the stack, with one of the following values: 
success - The user has pressed the Next button 
back - The user has pressed the Back button 
cancel - The user has pressed the Cancel button 
error - An error has occurred, the dialog cannot be displayed. 
Usually, you don't need to check this value, but you still have to remove it from the stack (have a look at the example above). 
You only have to check this value if you need something really special, such as doing something when the user pressed the Back button. 

사람이 새로운 방법을 알아내는 저를 도울 수 :

은 InstallOptionsEx 추가 정보 파일에서 무엇입니까? 아래 코드 파일을 보면 이전 섹션과 새로운 섹션이 있으며 새 섹션에서는 내가하려는 것을 볼 수 있습니다. 코드에 대한 도움이 필요합니다.

INI 파일

[Settings] 
NumFields=5 

[Field 1] 
Type=Label 
Left=160 
Right=235 
Top=9 
Bottom=18 
Text="DropDown 1" 
txtAlign=Center 


[Field 2] 
Type=DROPLIST 
ListItems=Option 1a|Option 1b|Option 1c 
State= 
Flags= 
Left=160 
Right=235 
Top=18 
Bottom=25 

[Field 3] 
Type=Label 
Left=240 
Right=295 
Top=9 
Bottom=18 
Text="DropDown 2" 
txtAlign=Center 


[Field 4] 
Type=DROPLIST 
ListItems=Option 2a|Option 2b|Option 2c 
State= 
Flags= 
Left=240 
Right=295 
Top=18 
Bottom=28 

[Field 5] 
Type=Button 
Flags=NOTIFY 
State= 
Text="More Info" 
Left=200 
Right=250 
Top=125 
Bottom=140 
txtAlign=Center 

코드 파일

!include WinVer.nsh 
!include LogicLib.nsh 
!include x64.nsh 
!include FileFunc.nsh 
!include MUI2.nsh 
!include WinMessages.nsh 
!include InstallOptions.nsh 
!include Sections.nsh 
!include nsDialogs.nsh 

!define MUI_HEADERIMAGE 

    !define TEMP1 $R0 ;Temp variable 

Page custom ShowCustom LeaveCustom ;Custom page. InstallOptions gets called in SetCustom. 
!insertmacro MUI_LANGUAGE "English" 

Function .onInit 
    InitPluginsDir 
    File /oname=$PLUGINSDIR\pagesetup.ini "pagesetup.ini" 
FunctionEnd 


Function ShowCustom 
    InstallOptionsEx::initDialog "$PLUGINSDIR\pagesetup.ini" 
    Pop $0 
    InstallOptionsEx::show 
    Pop $0 
FunctionEnd 


#Old Method 
/* 
Function LeaveCustom 
    ReadINIStr $0 "$PLUGINSDIR\pagesetup.ini" "Settings" "State" 
    StrCmp $0 0 validate ; Next button? 
    StrCmp $0 5 Infobtn ; 
    Abort ; Return to the page 
Infobtn 
    MessageBox MB_OK|MB_USERICON|MB_TOPMOST "Infobtn Pressed" 
Abort ; Return to the page 

validate: 
    MessageBox MB_OK|MB_USERICON|MB_TOPMOST "Next Pressed" 
    #Some Code to check if Field 2 and Field 4 have something selected 
    Abort 
FunctionEnd 
*/ 

#New Method 
Function LeaveCustom 
#Not sure correct code 

#If Back Btn Pressed goto backbtn 
#If Cancel Btn Pressed goto cancelbtn 
#If Next Btn Pressed goto nextbtn 
#If Info btn Press goto infobtn 

backbtn: 
    MessageBox MB_OK|MB_USERICON|MB_TOPMOST "Backbtn Pressed" 
Abort 

cancelbtn: 
    MessageBox MB_OK|MB_USERICON|MB_TOPMOST "Cancelbtn Pressed" 
Abort 

nextbtn: 
    MessageBox MB_OK|MB_USERICON|MB_TOPMOST "Nextbtn Pressed" 
Abort 

infobtn: 
    MessageBox MB_OK|MB_USERICON|MB_TOPMOST "Infobtn Pressed" 
Abort 

FunctionEnd 

Section 

SectionEnd 

답변

0

그럼 난 마침내 그것을 알아 냈어 내가 넣다 게시 것이지만 다른 사람이 필요합니다 여기

는 INI 파일과 코드 파일입니다.

내가이 있었다 :

Function ShowCustom 
    InstallOptionsEx::initDialog "$PLUGINSDIR\pagesetup.ini" 
    Pop $0 
    InstallOptionsEx::show 
    Pop $0 
FunctionEnd 

를 그리고이 있었어야 : (예가 없었을한다)

Function ShowCustom 
    InstallOptions::initDialog "$PLUGINSDIR\pagesetup.ini" 
    Pop $0 
    InstallOptions::show 
    Pop $0 
FunctionEnd 
가 이

그럼 그냥

ReadINIStr $0 "$PLUGINSDIR\test.ini" "Settings" "State" 
    StrCmp $0 0 validate ; Next button? 
    StrCmp $0 2 supportx ; "Install support for X"? 
    StrCmp $0 9 clearbtn ; "Clear" button? 
    StrCmp $0 11 droplist ; "Show|Hide" drop-list? 
    Abort ; Return to the page 
을 확인하기 위해 전류를 사용