Inno Setup:以编程方式取消选中组件后更新所需的大小

时间:2018-08-12 10:40:04

标签: inno-setup

假设我要取消选中组件3-5:

procedure CurPageChanged(CurPageID: Integer);
var i: integer;
begin
  if CurPageID = wpSelectComponents then
    { 0 based index }
    for i:= 2 to 4 do begin
      WizardForm.ComponentsList.Checked[i] := False;
    end;
end;

工作正常,已将其禁用,但窗口底部所需的总尺寸仍显示所有组件的值。有办法更新吗?

修改:尝试替换

WizardForm.ComponentsList.Checked[i] := False;

WizardForm.ComponentsList.CheckItem(i, coUncheck);

但是它没有任何改变。

1 个答案:

答案 0 :(得分:1)

终于找到了! Support Classes Reference页面显示TWizardForm.ComponentsList具有属性OnClickCheck,这似乎是指向未公开的TWizardForm.ComponentsListClickCheck过程的指针。我只想添加一行:

WizardForm.ComponentsList.OnClickCheck(nil);

完整示例:

procedure CurPageChanged(CurPageID: Integer);
var i: integer;
begin
  if CurPageID = wpSelectComponents then begin
    { 0 based index }
    for i:= 2 to 4 do begin
      WizardForm.ComponentsList.CheckItem(i, coUncheck);
    end;
    WizardForm.ComponentsList.OnClickCheck(nil);
  end;
end;