tags:

views:

98

answers:

1

Hi, I am creating a installer which is having multiple component to install(checkbox are provide to select the desired component). Now, suppose user has not selected any option, even then Next button on the component page is activated.Here I want to disable that next button when no option is selected. Can anybody tell me how I can do that ? Please Help me

A: 

Hi Bharat

your problem is really hard to solve if you use standard collection windows as MUI or XPUI, if you are using Modern UI (MUI) then the next code could help you to code the functionality you need (in the XPUI case this does not work at all)

WARNING : I did NOT tested the next procedures (just compiled), because i'm currently using XPUI and i have deprecated the MUI in my installer, moreover i have provided no logic to re-enable the "next" button in the OnChange_Service function.

  1. handle the event change on your target section, i do not know if it works, but i propose to use the NSD_OnChange procedure (defined in nsdialogs)

    !include 'nsdialogs.nsh'

    Function <...>
    
    ${NSD_OnChange} <... name of the target section ...> OnChange_Service
    
    FunctionEnd
    
  2. In the event handler function place the code to disable your button

    function OnChange_Service

    var /GLOBAL NextButton

    GetDlgItem $NextButton $HWNDPARENT 1

    SectionGetFlags <... name of the target section ...> $0

    IntOp $0 $0 & ${SECTION_OFF}

    StrCmp $0 "1" DISABLENEXT GOTOENDONCHANGE

    DISABLENEXT:

    EnableWindow $NextButton 0

    GOTOENDONCHANGE:

    functionend

Anywhere i think it is better to use custom window if you need to do some manipulations on the window control state.

Make me know if it works in your project

(If you want to use boolean operator in your code, then use the LogicLib plugin)

Marcello Faga