Menu

#118 OnInstTypeChange callback

closed-fixed
5
2007-02-08
2007-01-31
No

Adds a callback function .onInstTypeChange, analogous to .onSelChange/.onMouseOverSection.

I needed this to fulfill a customer requirement to have a description for each installation type, and figured it would be useful to others as well.

Note: The implementation sticks the current insttype in $0; this is because I couldn't get GetCurInstType to report the custom type properly in the callback (GetCurInstType would return the id of the previously selected insttype instead of NSIS_MAX_INST_TYPES when custom was selected).

Discussion

  • Espen Wiborg

    Espen Wiborg - 2007-01-31

    Adds .onInstTypeChange callback

     
  • Amir Szekely

    Amir Szekely - 2007-02-02

    Logged In: YES
    user_id=584402
    Originator: NO

    Thanks for your patch.

    .onSelChange is called when the installation type is changed. You can then get the current selection of the combo box. You could also use GetCurInstType, but as you said, that won't report Custom, because its report is based on the sections' selection and not the combo box.

    It seems to me that the following code acts almost like .onInstTypeChange. The only difference I see, is that when custom is selected, you'll get last_insttype_index + 1 instead of NSIS_MAX_INST_TYPES. Am I missing something, or is this really the case?

    !include WinMessages.nsh
    Function .onSelChange
    FindWindow $2 "#32770" "" $HWNDPARENT
    GetDlgItem $0 $2 1017
    SendMessage $0 ${CB_GETCURSEL} "" "" $1
    GetDlgItem $0 $2 1006
    SendMessage $0 ${WM_SETTEXT} "" "STR:$1"
    FunctionEnd

     
  • Amir Szekely

    Amir Szekely - 2007-02-02
    • assigned_to: nobody --> kichik
     
  • Espen Wiborg

    Espen Wiborg - 2007-02-07

    Logged In: YES
    user_id=1707163
    Originator: YES

    I didn't even consider that, but of course it works!

    Maybe add a comment to the .onSelChange documentation that it is also called when the installation type changes?

     
  • Amir Szekely

    Amir Szekely - 2007-02-08
    • labels: --> Documentation
    • status: open --> closed-fixed
     
  • Amir Szekely

    Amir Szekely - 2007-02-08

    Logged In: YES
    user_id=584402
    Originator: NO

    Sure thing. Added. Thanks.

     

Log in to post a comment.

MongoDB Logo MongoDB