Вопрос Проверка для компонента на наличие файла

Xabib2302

Новичок
Доброе время суток. Как реализовать проверку для компонента на наличие файла? Т.е при отсутствии файла или папки к которому привязан компонент снимался чекбокс и блокировался компонент. Пример в виде картинки компонента "Help"

2022-01-26_125847.png
 

Andreo Fadio

Старожил
@Xabib2302,
Код:
[Setup]
AppName=My Program
AppVersion=1.5
WizardStyle=modern
DefaultDirName={autopf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
OutputDir=userdocs:Inno Setup Examples Output

[Types]
Name: "full"; Description: "Full installation"
Name: "custom"; Description: "Custom installation"; Flags: iscustom

[Components]
Name: "program"; Description: "Main application"; Types: full; Flags: fixed
Name: "hp"; Description: "Libraries"; Types: full
Name: "hp/1"; Description: "Shematic libraries"; Types: full
Name: "hp/2"; Description: "Footprint libraries"
Name: "hp/3"; Description: "Footprint 3d Models"
Name: "gp"; Description: "Footprint wizards"
Name: "jp"; Description: "Demonstration projects"
Name: "helps"; Description: "Help files"; Types: full
Name: "np"; Description: "File associations"

[code]
procedure CurPageChanged(CurPageID: Integer);
begin
  case CurPageID of
  wpSelectComponents:
   begin
//    if not FileExists(ExpandConstant('{src}\help.chm')) then
    if not DirExists(ExpandConstant('{src}\help')) then
     begin
      WizardForm.ComponentsList.Checked[7]:= False;
      WizardForm.ComponentsList.ItemEnabled[7]:= False;
     end;
   end;
  end;
end;
 
Сверху