How to disable a button in NSIS during installation?

I am creating an installer that has several components for installation (the checkbox contains a selection of the desired component). Now suppose that the user has not selected any parameter, even then the "Next" button on the component page is activated. Here I want to disable this next button if the option is not selected. Can someone tell me how can I do this? Please help me

+3
source share
1 answer

Your problem is really difficult to solve, if you use standard data collection windows like MUI or XPUI, if you use Modern UI (MUI), then the following code can help you copy the functions you need (in the case of XPUI this does not work at all)

WARNING : I did NOT check the following procedures (just compiled) because I am currently using XPUI and I am deprecated from MUI in my installer, moreover, I provided without logic to enable the Next button again in the OnChange_Service function.

  • handle the event change in the target section, I don’t know if it works, but I suggest using the NSD_OnChange procedure (defined in nsdialogs)

    ! enable 'nsdialogs.nsh'

    Function <...>
    
    ${NSD_OnChange} <... name of the target section ...> OnChange_Service
    
    FunctionEnd
    
  • ,

    OnChange_Service

    var/GLOBAL NextButton

    GetDlgItem $NextButton $HWNDPARENT 1

    SectionGetFlags <... ... > $0

    IntOp $0 $0 ${SECTION_OFF}

    StrCmp $0 "1" DISABLENEXT GOTOENDONCHANGE

    DISABLENEXT:

    EnableWindow $NextButton 0

    GOTOENDONCHANGE:

    functionend

, , , .

,

( , LogicLib)

+1

Source: https://habr.com/ru/post/1761883/


All Articles