How to disable Next button if no component is selected in Inno Setup?

preethi

I have three components and if the user select any component it will do installations. Now I want to disable the Next button if the user don't select any components.

I am trying if not IsComponentSelected('xxx'), but it is not working. Can anyone please help me??

Martin Prikryl

There's no easy way to update the Next button state on component selection change.

A way easier is to display a message when the Next button is clicked:

function NextButtonClick(CurPageID: Integer): Boolean;
begin
  Result := True;

  if CurPageID = wpSelectComponents then
  begin
    if WizardSelectedComponents(False) = '' then
    begin
      MsgBox('No component selected', mbInformation, MB_OK);
      Result := False;
    end;
  end;
end;

If you insist on disabling the Next button, use this:

var
  TypesComboOnChangePrev: TNotifyEvent;

procedure ComponentsListCheckChanges;
begin
  WizardForm.NextButton.Enabled := (WizardSelectedComponents(False) <> '');
end;

procedure ComponentsListClickCheck(Sender: TObject);
begin
  ComponentsListCheckChanges;
end;

procedure TypesComboOnChange(Sender: TObject);
begin
  { First let Inno Setup update the components selection }
  TypesComboOnChangePrev(Sender);
  { And then check for changes }
  ComponentsListCheckChanges;
end;

procedure InitializeWizard();
begin
  WizardForm.ComponentsList.OnClickCheck := @ComponentsListClickCheck;

  { The Inno Setup itself relies on the WizardForm.TypesCombo.OnChange, }
  { so we have to preserve its handler. }
  TypesComboOnChangePrev := WizardForm.TypesCombo.OnChange;
  WizardForm.TypesCombo.OnChange := @TypesComboOnChange;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpSelectComponents then
  begin
    ComponentsListCheckChanges;
  end;
end;

To understand why you need so much code for such a little task, see Inno Setup ComponentsList OnClick event

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Inno Setup disable component selection when a specific component is selected

From Dev

Inno Setup Disable Next button when input is not valid

From Dev

How to completely disable specific component in Inno Setup from code section?

From Dev

How to disable OK button in "Browse For Folder" dialog in Inno Setup

From Dev

Inno Setup: Suppress warning if other component selected

From Dev

Inno Setup rename file if component selected

From Dev

Inno Setup: Suppress warning if other component selected

From Dev

Inno Setup - Disable dropdown list on Selected Components Menu

From Dev

Inno Setup - See how many components are selected

From Dev

Disable next button in Visual Studio setup project

From Dev

Inno Setup Task checked only if a specific Component is selected

From Dev

Inno Setup Change AppName based on component(s) selected

From Dev

NSIS - Disable "Uninstall" button if no component is selected

From Dev

NSIS - Disable "Uninstall" button if no component is selected

From Dev

Inno Setup remove/hide (not just disable) the Back button on a Wizard Page

From Dev

Inno Setup: Add button action for skipping to next page

From Dev

How to create an image button in Inno Setup?

From Dev

How to set Launch program according to components selected in Inno Setup?

From Dev

Inno Setup: Disable finish page

From Dev

Inno Setup: Multiple Next Buttons

From Dev

Inno Setup - How to increase the separation between all the components of the component list?

From Dev

Inno Setup: Function to select a component

From Dev

Inno Setup - How to skip files depending on radio button

From Dev

How to create a scrollable radio button list in Inno Setup?

From Dev

Inno Setup - How to skip files depending on radio button

From Dev

colorbox: how to disable next and previous button

From Dev

How to disable the button next to Activities in GNOME?

From Dev

QWizardPage: how to re-disable "Next" button

From Dev

Ionic 2 - How to disable a button component

Related Related

  1. 1

    Inno Setup disable component selection when a specific component is selected

  2. 2

    Inno Setup Disable Next button when input is not valid

  3. 3

    How to completely disable specific component in Inno Setup from code section?

  4. 4

    How to disable OK button in "Browse For Folder" dialog in Inno Setup

  5. 5

    Inno Setup: Suppress warning if other component selected

  6. 6

    Inno Setup rename file if component selected

  7. 7

    Inno Setup: Suppress warning if other component selected

  8. 8

    Inno Setup - Disable dropdown list on Selected Components Menu

  9. 9

    Inno Setup - See how many components are selected

  10. 10

    Disable next button in Visual Studio setup project

  11. 11

    Inno Setup Task checked only if a specific Component is selected

  12. 12

    Inno Setup Change AppName based on component(s) selected

  13. 13

    NSIS - Disable "Uninstall" button if no component is selected

  14. 14

    NSIS - Disable "Uninstall" button if no component is selected

  15. 15

    Inno Setup remove/hide (not just disable) the Back button on a Wizard Page

  16. 16

    Inno Setup: Add button action for skipping to next page

  17. 17

    How to create an image button in Inno Setup?

  18. 18

    How to set Launch program according to components selected in Inno Setup?

  19. 19

    Inno Setup: Disable finish page

  20. 20

    Inno Setup: Multiple Next Buttons

  21. 21

    Inno Setup - How to increase the separation between all the components of the component list?

  22. 22

    Inno Setup: Function to select a component

  23. 23

    Inno Setup - How to skip files depending on radio button

  24. 24

    How to create a scrollable radio button list in Inno Setup?

  25. 25

    Inno Setup - How to skip files depending on radio button

  26. 26

    colorbox: how to disable next and previous button

  27. 27

    How to disable the button next to Activities in GNOME?

  28. 28

    QWizardPage: how to re-disable "Next" button

  29. 29

    Ionic 2 - How to disable a button component

HotTag

Archive