如何在Inno Setup中创建可滚动的单选按钮列表?

时间:2015-09-07 06:42:04

标签: inno-setup

我创建了一个向导,允许用户从单选按钮中选择,但是当选择超过对话框大小时我遇到问题,它不会显示其余选项,如下图所示:

enter image description here

我希望使用向下滚动条,但很难在线查找教程。任何人都可以提供帮助吗?

for code := 0 to 9 do
begin
  CheckBox := TNewCheckListBox.Create(Page);
  CheckBox.Parent := Page.Surface;
  CheckBox.AddCheckBox('test', '', 0, True, False, False, True, nil);
  CheckBox.AddRadioButton('1', '', 1, True, True, nil );
  CheckBox.AddRadioButton('2', '', 1, False,True, nil );
end

1 个答案:

答案 0 :(得分:2)

为所有复选框和单选按钮创建一个大TNewCheckListBox,而不是为每个集创建一个单独的框。如果其内容不适合,TNewCheckListBox将自动显示滚动条。

function CustomPage(var Page:TWizardPage;PageId:Integer):Integer;
var
  CheckListBox: TNewCheckListBox;       
begin
  Page:=CreateCustomPage(PageId,ExpandConstant('AAA'),ExpandConstant('BBB'));
  CheckListBox:=TNewCheckListBox.Create(Page);
  with CheckListBox do begin       
    Parent:=Page.Surface;          
    Left:=ScaleX(0);
    Top:=ScaleY(50);
    Width:=ScaleX(413);
    Height:=ScaleY(153);              
    AddCheckBox(ExpandConstant('Test'),'',0,False,True,False,True,Nil);
    AddRadioButton(ExpandConstant('1'),'',1,True,True,Nil);               
    AddRadioButton(ExpandConstant('2'),'',1,False,True,Nil);                    
    AddCheckBox(ExpandConstant('Test'),'',0,False,True,False,True,Nil);
    AddRadioButton(ExpandConstant('1'),'',1,True,True,Nil);               
    AddRadioButton(ExpandConstant('2'),'',1,False,True,Nil);
    AddCheckBox(ExpandConstant('Test'),'',0,False,True,False,True,Nil);
    AddRadioButton(ExpandConstant('1'),'',1,True,True,Nil);               
    AddRadioButton(ExpandConstant('2'),'',1,False,True,Nil);
    AddCheckBox(ExpandConstant('Test'),'',0,False,True,False,True,Nil);
    AddRadioButton(ExpandConstant('1'),'',1,True,True,Nil);               
    AddRadioButton(ExpandConstant('2'),'',1,False,True,Nil);
  end;
  Result:=Page.ID;
end;

procedure InitializeWizard();
var
  NewPage: TWizardPage;       
  NewPageID:Integer;                  
begin            
  NewPageID:=CustomPage(NewPage,wpWelcome);     
end;

示例2:

function CustomPage(var Page:TWizardPage;PageId:Integer):Integer;
var
  CheckBox: TNewCheckListBox;     
  I:Integer;
begin
  Page:=CreateCustomPage(PageId,ExpandConstant('AAA'),ExpandConstant('BBB'));
  CheckBox:=TNewCheckListBox.Create(Page);
  with CheckBox do begin       
    Parent:=Page.Surface;       
    Left := ScaleX(0);
    Top := ScaleY(56);
    Width := ScaleX(413);
    Height := ScaleY(153);
    for I:=0 to 9 do begin       
      AddCheckBox('test', '', 0, True, False, False, True, nil); 
      AddRadioButton('1', '', 1, True, True, nil ); 
      AddRadioButton('2', '', 1, False,True, nil );             
    end;
  end;
end;

enter image description here

相关问题