How do you create a scrollable TW3ListMenu at run-time?
I need something a little better for scrolling vertically through 50 items I'd like to use a TW3ListMenu and just display the caption and a icon to the right ">" to click - then display the additional information on a secondary form.
How do I create a scrollable list of items using a TW3ListMenu?
I created the TW3ListMenu on a TW3ScrollBox, but it does not seem to scroll
Maybe its the layout ?
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;
I even tried two layouts....
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)]);
warleyalex posted a solution on the Smart Mobile Studio form
A solution which uses the qtxlibrary