Create button into a li (TItemList) object

I'm facing a difficulty to create a TWebButton inside a HTML template code for a TListItem
I'm using event for TWebListControl
GetItemChildren(Sender: TObject; AItem: TListItem; AElement: TJSHTMLElementRecord);

But there isn't parent control provided here so the create button isn't replacing the elementid from html code and is created in the closest parent I found = TWebListControl

But in this case the place of button is wrong (but working)

procedure TFormView_Carto.List_ResultsGetItemChildren(Sender: TObject;
  AItem: TListItem; AElement: TJSHTMLElementRecord);
  ButtonGoDepot    : TWebButton;
  ButtonGoItiner   : TWebButton;
  ButtonGoIti_Name : String;
    procedure ButtonDepotClick(Sender: TObject);
        DM_Main.WebDebuglog('Module API >> ButtonDepotClick');
        DM_Main.WebDebuglog('Tag = '+IntToStr((Sender as TWebButton).tag));
        DM_Main.WebDebuglog('Module API << ButtonDepotClick');
    if (AItem.Tag<>0) then
        ButtonGoIti_Name  := StringReplace('button_go_{{POI_ID}}','{{POI_ID}}',IntToStr(AItem.Tag),[rfReplaceAll,rfIgnoreCase]);

        ButtonGoItiner := TWebButton.Create(List_Results);
        ButtonGoItiner.Caption          := 'ITI '+IntToStr(AItem.Tag);
        ButtonGoItiner.Cursor           := crHandPoint;
        ButtonGoItiner.OnClick          := @ButtonDepotClick;
        ButtonGoItiner.ElementClassName := 'button-outline button-itinerary';
        ButtonGoItiner.ElementID        := ButtonGoIti_Name;
        ButtonGoItiner.Parent           := List_Results;
        ButtonGoItiner.ElementPosition  := epIgnore;
        ButtonGoItiner.WidthStyle       := TSizeStyle.ssAuto;
        ButtonGoItiner.HeightStyle      := TSizeStyle.ssAuto;
        ButtonGoItiner.Tag              := AItem.Tag;


Is there a way to work with TWebListControl or do I need to change of component ?


Please note that the TWebListControl was designed to only include text in the TWebListItems.
Unfortunately it's currently not supported to add web controls to the TWebListItems.

Hi Bart,

OK I understand that

What can be the alternative webcore component to be able to create a parent component and then to include several child components where to create included button (similar to cell in WebTableControl through OnGetCellChildren) ?


Hi Sylvain,

Have you tried using a TWebGridPanel instead?