ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TImageEnMView Issue

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
a.gosling Posted - Mar 07 2024 : 01:55:03
Hi,

in the ImageEN Version 13 I have problems using the TImageEnMView. Theese problems didn't occur in the Version 11. I don't know, if they where present in Version 12.

I made a simple project:
- Loading 3 fixed Images in the List
- Adding ImageBottomText and ImageTag to all of them

Expected result:
- Pic1 with the Pottom Text "Pic 0" and ImageTag = 0
- Pic2 with the Pottom Text "Pic 1" and ImageTag = 1
- Pic3 with the Pottom Text "Pic 2" and ImageTag = 2

Result in fact;
- Pic1 with the Pottom Text "Pic 2" and ImageTag = 2
- Pic2 no Pottom Text and no ImageTag
- Pic3 no Pottom Text and no ImageTag

Can you help me with this problem?

Sourcecode:
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, hyiedefs, hyieutils, iexBitmaps,
  iesettings, iemio, ieview, iemview;

type
  TForm1 = class(TForm)
    imgList: TImageEnMView;
    procedure FormShow(Sender: TObject);
    procedure imgListImageSelect(Sender: TObject; idx: Integer);
  private
    procedure LoadPictures;
  public
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormShow(Sender: TObject);
begin
  LoadPictures;
end;

procedure TForm1.imgListImageSelect(Sender: TObject; idx: Integer);
begin
  Caption := 'Select Picture ImageTag: ' + imgList.ImageTag[idx].ToString;
end;

procedure TForm1.LoadPictures;
var
  NdxDokList: Integer;
  FileNames: TStringList;
  Ndx: Integer;
begin
  imgList.Clear;

  FileNames := TStringList.Create;
  FileNames.Add(ExtractFilePath(ParamStr(0)) + 'Pic1.png');
  FileNames.Add(ExtractFilePath(ParamStr(0)) + 'Pic2.png');
  FileNames.Add(ExtractFilePath(ParamStr(0)) + 'Pic3.png');

  imgList.LockPaint;
  imglist.Deselect;

  for Ndx := 0 to FileNames.Count -1 do
  begin
    if ( imglist.MIO.LoadFromFileAuto(FileNames[Ndx]) ) then
    begin
      imglist.ImageBottomText[imglist.ImageCount - 1] := 'Pic ' + Ndx.ToString;
      imglist.ImageTag[imglist.ImageCount - 1] := Ndx;
    end;
  end;

  imgList.UnlockPaint;

  FileNames.Free;
end;

end.
6   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Mar 12 2024 : 20:13:08
Hi Ansgar

Yes, at this time, AppendImage() does not add all images of multi-frame files.

Nigel
Xequte Software
www.imageen.com
a.gosling Posted - Mar 12 2024 : 02:21:20
Hi Nigel,

awesome, thanks! Now I got, where the problem is :-)

As I'm now using a slightly different solution, I share this here:
I want to use the LoadFromFileAuto - function, because in the original source (I posted an simple "Reproduce-This-Bug-Project" here ) there are not only images and pdfs in the "FileList". LoadFromFileAuto simply extracts them for me.

My solution ist using
imglist.ImageBottomText[0]


instead of
imglist.ImageBottomText[imglist.ImageCount - 1]



kind regards
Ansgar
xequte Posted - Mar 11 2024 : 20:00:14
Hi Ansgar

If you use LoadFromFileAuto() to add an image to a TImageEnMView, then it is added at the current cursor position (not the end of the list), i.e. index will be 0 not, imglist.ImageCount - 1.

You are better to append the image as follows:

  for Ndx := 0 to FileNames.Count -1 do
  begin
    imglist.AppendImage(FileNames[Ndx]);
    imglist.ImageBottomText[imglist.ImageCount - 1] := 'Pic ' + Ndx.ToString;
    imglist.ImageTag[imglist.ImageCount - 1] := Ndx;
  end;


Nigel
Xequte Software
www.imageen.com
a.gosling Posted - Mar 11 2024 : 02:04:50
Hi,

thank you for your answer. Unfortunately I get the same wrong result, if I first execute imgList.UnlockPaint and then iterate through the FileNames to set ImageTag and ImageBottomText.

Any other ideas?

edit:
- I'm using Delphi 12.1
- I attached the project



Ansgar Gosling


attach/a.gosling/202431121639_TestImageEN.zip
78.81 KB
xequte Posted - Mar 10 2024 : 17:08:48
Yes, please implement John's code suggestion.

Nigel
Xequte Software
www.imageen.com
jctaylor Posted - Mar 10 2024 : 09:46:55
Shouldn't before the imgList.UnlockPaint be?:

for Ndx := 0 to FileNames.Count -1 do
  begin
    if ( imglist.MIO.LoadFromFileAuto(FileNames[Ndx]) ) then
    begin
      imglist.ImageBottomText[Ndx] := 'Pic ' + Ndx.ToString;
      imglist.ImageTag[Ndx] := Ndx;
    end;
  end;


John Taylor