I am using the following to create some TWebImageControls at runtime.
procedure TForm7.WebHttpRequestImagesRequestResponse(Sender: TObject;
ARequest: TJSXMLHttpRequestRecord; AResponse: string);
var
i: integer;
json: TJSON;
jobject,jobject2: TJSONObject;
playerNameString : String;
playerName : TWebMultimediaPlayer;
playerNameImage : TWebImageControl;
playerLabel,playerLabelImage : TWebLabel;
playerPanel,playerPanelImage : TWebPanel;
grdItem,gridItemImage: TWebResponsiveGridPanel;
begin
//WebImageSlider1.ImageURLs.Clear;
json := TJSON.Create;
try
jArrayImages := TJSONArray(json.Parse(AResponse));
for i := 0 to jArrayImages.Count - 1 do
begin
jobject := TJSONObject(jArrayImages.Items[i]);
playerPanelImage := TWebPanel.Create(self);
playerNameImage := TWebImageControl.Create(self);
playerLabelImage := TWebLabel.Create(self);
playerPanelImage.WidthStyle := ssPercent;
playerPanelImage.WidthPercent := 100;
playerPanelImage.left := 100;
playerPanelImage.top := 100;
playerPanelImage.height := 600;
playerPanelImage.visible := true;
playerPanelImage.Color := clRed;
playerPanelImage.ElementClassName := 'WebCSSClassShadow';
playerNameImage.ElementClassName := 'WebClassPadding';
playerLabelImage.ElementClassName := 'WebClassPadding';
playerNameImage.Align := alClient;
playerNameImage.visible := true;
playerLabelImage.Caption := jobject.GetJSONValue('Picture');
playerNameImage.Parent := playerPanelImage;
playerLabelImage.Parent := playerPanelImage;
playerPanelImage.Parent := WebResponsiveGridPanel3;
playerLabelImage.Align := alBottom;
playerLabelImage.height := 10;
playerLabelImage.visible := true;
playerNameImage.URL := 'https://www.toolfolks.com/docs/'+ jobject.GetJSONValue('Picture');
playerLabelImage.Caption := jobject.GetJSONValue('Picture');
playerNameImage.OnClick := WebButton1Click;
end;
finally
json.Free;
playerLabel.Free;
playerLabelImage.Free;
end;
// populate images
// WebImageSlider1.RefreshImages;
end;
I need to be able to get the index of the image clicked.
ie playerNameImage.OnClick := showmessage(WebResponsiveGridPanel3.index.clicked)
Is this proper available.
I need this so I can set the WebSliderImage index to match the index of the image selected.