Delphi 2010, RVE 12.0.4, 5x5 table, TPNGObject (from PNGComponents adapted to D2010).
Inserting PNG picture into the table cell then pressing center alignment button raises Access Violation in RVERVData.pas here:
function TRVEditRVData.GetCurItemNo: Integer;
{........................................}
function IndexOf(obj: TCustomRVItemInfo): Integer;
var ItemNo: Integer;
begin
Result := -1;
if (CaretDrawItemNo>=0) and (CaretDrawItemNo<DrawItems.Count) then begin
ItemNo := DrawItems[CaretDrawItemNo].ItemNo; <<<-----<<<-----[HERE]-----
if (ItemNo>=0) and (ItemNo<Items.Count) and (GetItem(ItemNo)=obj) then
Result := ItemNo;
end;
if Result<0 then
Result := Items.IndexOfObject(obj);
end;
{........................................}
begin
PrepareForEdit;
...
procedure TMainForm.PicturesPaletteCellClick(Sender: TObject; ACol, ARow: Integer; var Allow: Boolean);
var png:TPNGObject;
begin
png:=TPNGObject.Create;
png.Assign(DM.ImageList2.PngImages.Items[ARow*PicturesPalette.RowCount+ACol].PngImage);
RichViewEdit1.InsertPicture('',png,rvvaAbsBottom);
Allow:=False;
end;
But now it's doesn't works because TImageList has only GetBitmap and GetIcon routines. But I want to insert PNG.
Is there a solution? Also I'm looking how can I save PNG image from TImageList to file on disk.