如何在运行时创建可滚动的 TW3ListMenu?
我需要更好的东西来垂直滚动 50 个项目,我想使用 TW3ListMenu,只需在右侧显示标题和图标“>”即可单击 - 然后在辅助表单上显示附加信息。
如何使用 TW3ListMenu 创建可滚动的项目列表?
我在 TW3ScrollBox 上创建了 TW3ListMenu,但它似乎没有滚动
也许它的布局?
procedure TfrmMain.InitializeObject;
var
i: Integer;
procedure AddMenuItem(caption: string);
var
li: TW3ListItem;
begin
li := fListMenu.Items.Add;
li.Text := caption;
li.OnClick :=
procedure (Sender: TObject)
begin
//ShowMessage('You clicked: ' + (Sender as TW3ListItem).Text);
end;
end; //addmenu
begin
inherited;
{$I 'frmMain:impl'}
fHeader:= TW3HeaderControl.Create(self);
fHeader.Height:= 50;
fHeader.Title.Caption := 'Mountains';
fHeader.Title.AlignText:= taCenter;
fHeader.BackButton.Visible:= False;
fHeader.StyleClass:= 'TW3Header';
fBackButton:= TMenuButton.Create(self);
fBackButton.Caption:= 'Back';
fBackButton.Height:= 50;
fBackButton.StyleClass:= 'TMenuButton';
fBackButton.OnClick:= BackButtonClick;
fScrollBox:= TW3Scrollbox.Create(self);
fListMenu:= TW3ListMenu.Create(fScrollbox);
For i:= 1 to 46 do
AddMenuItem(IntToStr(i));
FLayout :=
Layout{1}.Client(Layout{2}.Margins(5).Spacing(5), [
Layout{3}.Top(fHeader),
Layout{4}.Client(fScrollbox),
Layout{5}.Bottom(fBackButton)]);
end;
我什至尝试了两种布局....
fScrollBox:= TW3Scrollbox.Create(self);
fListMenu:= TW3ListMenu.Create(fScrollbox);
For i:= 1 to 46 do
AddMenuItem(IntToStr(i));
FScrollLayout :=
Layout{1}.Client(Layout{2}.Margins(5).Spacing(5), [
Layout{3}.Client(fScrollbox)]);
FLayout :=
Layout{1}.Client(Layout{2}.Margins(5).Spacing(5), [
Layout{3}.Top(fHeader),
Layout{4}.Client(fScrollLayout),
Layout{5}.Bottom(fBackButton)]);