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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to select an object from Listbox1.Items index on the ImageEnVect?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Jmich

Germany
5 Posts

Posted - Feb 07 2024 :  16:05:33  Show Profile  Reply
Here's my code:
But this does not work!
Who has a solution or idea.



var
i: Integer;
begin
   if (listbox1.ItemIndex < > -1) and (listbox1.ItemIndex < ImageEnVect1.ObjectsCount) then
      begin
        for i: = 0 to ImageEnVect1.ObjectsCount - 1 do
         begin
           if (ImageEnVect1.ObjText [i] = '' + listbox1.Items [listbox1.ItemIndex] + '') then
            begin
              ImageEnVect1.SelObjects [i];
              Exit;
             end;
          end;
        end;
end;


jm

xequte

38341 Posts

Posted - Feb 07 2024 :  19:30:57  Show Profile  Reply
Hi

Firstly, if this is a new application, don't use TImageEnVect, use TIELayers instead:

https://www.imageen.com/help/TImageEnVect_vs_TIELayers.html


TImageEnVect does not use indexes but IDs for properties, so you need to pass the ID to ObjText[]. so you should use:

http://www.imageen.com/help/TImageEnVect.GetObjFromIndex.html

i.e.

if (ImageEnVect1.ObjText[ImageEnVect1.GetObjFromIndex( i )] = '' + listbox1.Items[listbox1.ItemIndex] + '') then
  ImageEnVect1.SelObjects [i];


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Jmich

Germany
5 Posts

Posted - Feb 08 2024 :  08:47:19  Show Profile  Reply
Is there any way to mark an object in the ImageENVect by code?

For example, I imagine:

procedure TForm2.Listbox1Click (broadcaster: TObject);
Var
  index: Integer;
begin
  ImageEnVect1. UnSelAllObjects;
  if Listbox1.ItemIndex < > -1 then
  begin
    Index: = Listbox1.ItemIndex;
    ImageEnVect1. SelObjects [index];
    label1. Caption: = IntToStr (index);
  end;
end;


jm
Go to Top of Page

xequte

38341 Posts

Posted - Feb 08 2024 :  19:26:04  Show Profile  Reply
How about:

procedure TForm2.Listbox1Click(Sender: TObject);
var
  index: Integer;
begin
  ImageEnVect1.UnSelAllObjects();
  if Listbox1.ItemIndex > -1 then
  begin
    Index := Listbox1.ItemIndex;
    ImageEnVect1.AddSelObject( ImageEnVect1.GetObjFromIndex( index ));
    label1.Caption: = IntToStr( index );
  end;
end;

http://www.imageen.com/help/TImageEnVect.AddSelObject.html


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Jmich

Germany
5 Posts

Posted - Feb 09 2024 :  10:53:44  Show Profile  Reply
Thanks for the help !
Works great !

best greetings
Jmich

jm
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: