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
 Naming / renaming a layer

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
DMC02766 Posted - Feb 23 2016 : 11:51:19
Currently I am trying to name / rename a layer by clicking a button next to an imageenmview component showing all of the layers, then typing in a text box to put in a name for the current layer then click save to name the layer. The problem I have is that it all works except all of the layers within the imageenmview show the name instead of the selected one and it doesnt save the name with the layers when the image is saved. Is there something I am doing incorrect? Below is my code:


 i:= imgview1.LayersCurrent;
   imgview1.currentlayer.Name := layernametext.Text;
   imgview1.update;

/// this part is for loading or refreshing the layer viewer
 for i := 0 to Imgview1.LayersCount - 1 do
  begin
    idx := ImageEnMView1.AppendImage;
    ImageEnMView1.SetIEBitmap(idx, Imgview1.Layers[i].Bitmap);
    ImageEnMView1.ImageTopText[i] := inttostr(i) + ' '+ imgview1.CurrentLayer.name;
  end;
  ImageEnMView1.SelectedImage := Imgview1.LayersCurrent;

3   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Feb 23 2016 : 13:46:12
This is one way to load and save layers to a file:

procedure TForm1.OpenLayers1Click(Sender: TObject);
var
  i: Integer;
begin
  OpenPictureDialog1.Filter := 'Layer (*.lyr)| *.lyr';
  if OpenPictureDialog1.Execute then
  begin
    if ImageEnView1.LayersLoadFromFile(OpenPictureDialog1.FileName) then
    begin
      for i := 0 to ImageEnView1.LayersCount - 1 do
      begin
        ImageEnMView1.AppendImage;
        if ImageEnView1.Layers[i].Name = '' then
          ImageEnView1.Layers[i].Name :=
            AnsiString('Layer ' + IntToStr(i));
        ImageEnMView1.ImageTopText[i] :=
          string(ImageEnView1.Layers[i].Name);
        ImageEnMView1.SetIEBitmapEx(i, ImageEnView1.Layers[i].Bitmap);
       end;
       ImageEnMView1.Update;
    end;
end;

procedure TForm1.SaveLayers1Click(Sender: TObject);
begin
  SavePictureDialog1.Filter := 'Layer (*.lyr)| *.lyr';
  if SavePictureDialog1.Execute then
  begin
    ImageEnView1.LayersSaveToFile(SavePictureDialog1.FileName);
  end;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
DMC02766 Posted - Feb 23 2016 : 13:31:18
Thanks Nigel!
xequte Posted - Feb 23 2016 : 13:00:36
That line should read:

ImageEnMView1.ImageTopText[i] := inttostr(i) + ' '+ imgview1.Layers[i].name;

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com