Jump to content
luciano_f

How to change the TVirtualImageList editor?

Recommended Posts

I use it a lot but your editor is horrible, how could I generate a new bpl and make some changes including saving the size and position

What is the pas file and the dfm? How could I reregister the editor when clicking on the component?

Share this post


Link to post

The source file of Image List Editor is: "C:\Program Files (x86)\Embarcadero\Studio\22.0\source\Property Editors\ImgEdit.pas"

 

How to construct a new property editor and register it is behind my knowledge.

 

P.S.: I don't know if the releases (Community, Professional) have those sources.

Edited by DelphiUdIT

Share this post


Link to post
25 minutes ago, DelphiUdIT said:

The source file of Image List Editor is: "C:\Program Files (x86)\Embarcadero\Studio\22.0\source\Property Editors\ImgEdit.pas"

 

How to construct a new property editor and register it is behind my knowledge.

 

P.S.: I don't know if the releases (Community, Professional) have those sources.

How could I generate the property record by changing these files?

Share this post


Link to post
1 hour ago, DelphiUdIT said:

The source file of Image List Editor is: "C:\Program Files (x86)\Embarcadero\Studio\22.0\source\Property Editors\ImgEdit.pas"

This Editor is for TImageList, not for TVirtualImageList. AFAIK, the editor for TVirtualImageList is not shipped as source.

  • Thanks 1

Share this post


Link to post
9 minutes ago, Uwe Raabe said:

This Editor is for TImageList, not for TVirtualImageList. AFAIK, the editor for TVirtualImageList is not shipped as source.

Even though it is not supplied with the sources, there must be some way to create a form that inherits it so that I can change and register this new editor

Share this post


Link to post
13 hours ago, luciano_f said:

Even though it is not supplied with the sources, there must be some way to create a form that inherits it so that I can change and register this new editor

Looking through ProcessHacker I found the class but I didn't find the files that refer to it  "TImageCollectionEditorForm"

Share this post


Link to post
Posted (edited)
57 minutes ago, luciano_f said:

but I didn't find the files that refer to it  "TImageCollectionEditorForm"

Try unit Imagecollectioneditorthe in the dclwinx package.

Edited by Uwe Raabe

Share this post


Link to post
2 minutes ago, Uwe Raabe said:

Try unit Imagecollectioneditorthe in the dclwinx package.

 


where do I find this ?

can you put the link ?

Share this post


Link to post

The package is part of the Delphi installation and the unit is included in the package. There is no source.

Share this post


Link to post
17 minutes ago, Uwe Raabe said:

The package is part of the Delphi installation and the unit is included in the package. There is no source.

I didn't find it and I looked on the web and there aren't even any references.

 

Can you attach it here?

 

Tell me will you do what I need ?

 

Share this post


Link to post

dclwinx.dcp is located in lib\win32\release in the Delphi folder and the corresponding design package (dclwinx280.bpl for Delphi 11) is located in the bin folder.

 

You won't find anything on the web for it, neither the package nor the unit, because Embarcadero doesn't provide any information for it.

Share this post


Link to post
1 hour ago, Uwe Raabe said:

dclwinx.dcp is located in lib\win32\release in the Delphi folder and the corresponding design package (dclwinx280.bpl for Delphi 11) is located in the bin folder.

 

You won't find anything on the web for it, neither the package nor the unit, because Embarcadero doesn't provide any information for it.

I don't understand your explanation because this file "ImageCollectionEditor" doesn't exist
I downloaded the trial architect 11.3 version and couldn't find it

Can you attach the file here on the forum please

Share this post


Link to post
10 hours ago, Uwe Raabe said:

Try unit Imagecollectioneditorthe in the dclwinx package.


Do you have this file on your machine ?

 

Share this post


Link to post
8 hours ago, luciano_f said:

Can you attach the file here on the forum please

It's not allowed to submit some files from Delphi, i think

Share this post


Link to post
10 hours ago, luciano_f said:

I don't understand your explanation because this file "ImageCollectionEditor" doesn't exist

I didn't say the file exists. When a unit is neither provided as source nor as a compiled DCU, it can still be provided inside a DCP file, which is the case for the unit ImageCollectionEditor. It is contained inside dclwinx.dcp and thus can be used in other design packages. I cannot give a link or attach that file because it is not listed under the Redist folder of Delphi.

Share this post


Link to post
24 minutes ago, Uwe Raabe said:

I didn't say the file exists. When a unit is neither provided as source nor as a compiled DCU, it can still be provided inside a DCP file, which is the case for the unit ImageCollectionEditor. It is contained inside dclwinx.dcp and thus can be used in other design packages. I cannot give a link or attach that file because it is not listed under the Redist folder of Delphi.

Could you explain to me then how I could use it? From the dcp?
 

Share this post


Link to post
Posted (edited)

Right way to do it – make designtime package with own implementation of TVirtualImageListEditor and TImageCollectionEditor. Then in this BPL you need to register these new classes as ComponentEditor for TImageCollection and TVirtualImageList. If you need only small changes – you can make decedent of TImageCollectionEditorForm, do all your logic, and reuse it in own components editors.
Package text will looks like:

package Package1;

{$R *.res}
{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO OFF}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION OFF}
{$OVERFLOWCHECKS ON}
{$RANGECHECKS ON}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DEFINE DEBUG}
{$ENDIF IMPLICITBUILDING}
{$IMPLICITBUILD ON}

requires
  rtl,
  dclWinx;

contains
  Unit3 in 'Unit3.pas';
end.

And your unit will be:

unit Unit3;

interface

uses
  {winxreg,} imagecollectionEditor, classes;

type
  TMyImageCollectionEditorForm = class(imagecollectionEditor.TImageCollectionEditorForm)
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  end;

implementation

{ TMyImageCollectionEditorForm }

constructor TMyImageCollectionEditorForm.Create(AOwner: TComponent);
begin
  inherited;
  //do restoring position of editor
end;

destructor TMyImageCollectionEditorForm.Destroy;
begin
  //do saving position of editor
  inherited;
end;

end.

Editor form for TVirtualImageList called TVirtualImageListEditorForm and it’s saved in unit VirtualImageListEditor. You can make decedent without sources in same way.

Edited by Softacom Company

Share this post


Link to post
Posted (edited)

@Softacom Company

 

Sorry for my ignorance, as I don't have enough knowledge to create and change components, could my colleague give me some help?

How could I create a new form that inherits from "TImageCollectionEditorForm" and I can make changes to it? I tried but I couldn't and also how could I register this BPL, see attached what I did

 

ImageListEdit Form.7z

 

If I could have access to the form I would change more things, such as this huge image preview area, see attached.

 

 

Change Forms.png

Edited by luciano_f

Share this post


Link to post
Posted (edited)

As we see – you don’t have any experience at component development. If you don't have original sources - you can't just make form in designer, you must do all your changes by your sources.

...
  Self.BorderIcons := [biSystemMenu, biMinimize, biMaximize, biHelp];
  Self.SourceImagesView.Margins.Bottom := 5;
...

we add into your package example how we can make component editor for TImageCollection with using of decedent of TImageCollectionEditorForm.

If you want - you can develop completely new form and use it by this editor. Also, you can make any other component editors for TVirtualImageList or any other components.

ImageListEdit Form.7z

P.S. Our recomentation - first read some doc about what is it "Component Editors" and how to make it.

Edited by Softacom Company

Share this post


Link to post
1 hour ago, Softacom Company said:

As we see – you don’t have any experience at component development. If you don't have original sources - you can't just make form in designer, you must do all your changes by your sources.


...
  Self.BorderIcons := [biSystemMenu, biMinimize, biMaximize, biHelp];
  Self.SourceImagesView.Margins.Bottom := 5;
...

we add into your package example how we can make component editor for TImageCollection with using of decedent of TImageCollectionEditorForm.

If you want - you can develop completely new form and use it by this editor. Also, you can make any other component editors for TVirtualImageList or any other components.

ImageListEdit Form.7z

P.S. Our recomentation - first read some doc about what is it "Component Editors" and how to make it.

 

I am very grateful

I managed to place the Splitter, Maximize form button but the create is not triggered See how I did it

 

constructor TMyImageCollectionEditorForm.Create(AOwner: TComponent);
begin
  inherited;

 
  Showmessage('Test'); do not execute this message

Self.BorderIcons := [biSystemMenu, biMaximize];

end;

 

procedure TMyImageCollectionEditor.ExecuteVerb(Index: Integer);
Var Splitter1: TSplitter;
begin
  //here we implement action when someone click on our menu item
  inherited;

  case Index of
    0: begin
      if Self.Component is TImageCollection then begin
        var xImCol := Self.Component as TImageCollection;
        var xMyEditor := TMyImageCollectionEditorForm.CreateEx(Nil, xImCol);
        try
          xMyEditor.BorderIcons := [biSystemMenu, biMaximize];

          xMyEditor.GroupBox1.Margins.Top := 3;
          xMyEditor.GroupBox1.Margins.Bottom := 3;
          xMyEditor.GroupBox1.Margins.Left := 3;
          xMyEditor.GroupBox1.Margins.Right := 10;

          xMyEditor.GroupBox2.Margins.Top := 3;
          xMyEditor.GroupBox2.Margins.Bottom := 3;
          xMyEditor.GroupBox2.Margins.Left := 3;
          xMyEditor.GroupBox2.Margins.Right := 10;

          Splitter1 := TSplitter.Create(xMyEditor);
          Splitter1.Parent := xMyEditor;
          Splitter1.Visible := True;
          Splitter1.Align := alBottom;
          Splitter1.Height := 9;
          Splitter1.Color := clHighlight;
          Splitter1.Top := xMyEditor.GroupBox2.Top + xMyEditor.GroupBox2.Height;

          xMyEditor.ShowModal;
        finally
          xMyEditor.Free;
        end;
      end;
    end;
  end;
end;

 

Change Forms 2.png

Share this post


Link to post
Posted (edited)
50 minutes ago, luciano_f said:

 

We are very grateful

We managed to place the Splitter, Maximize form button but the create is not triggered See how we did it

 


constructor TMyImageCollectionEditorForm.Create(AOwner: TComponent);
begin
  inherited;

 
  Showmessage('Test'); do not execute this message

Self.BorderIcons := [biSystemMenu, biMaximize];

end;

 


procedure TMyImageCollectionEditor.ExecuteVerb(Index: Integer);
Var Splitter1: TSplitter;
begin
  //here we implement action when someone click on our menu item
  inherited;

  case Index of
    0: begin
      if Self.Component is TImageCollection then begin
        var xImCol := Self.Component as TImageCollection;
        var xMyEditor := TMyImageCollectionEditorForm.CreateEx(Nil, xImCol);
        try
          xMyEditor.BorderIcons := [biSystemMenu, biMaximize];

          xMyEditor.GroupBox1.Margins.Top := 3;
          xMyEditor.GroupBox1.Margins.Bottom := 3;
          xMyEditor.GroupBox1.Margins.Left := 3;
          xMyEditor.GroupBox1.Margins.Right := 10;

          xMyEditor.GroupBox2.Margins.Top := 3;
          xMyEditor.GroupBox2.Margins.Bottom := 3;
          xMyEditor.GroupBox2.Margins.Left := 3;
          xMyEditor.GroupBox2.Margins.Right := 10;

          Splitter1 := TSplitter.Create(xMyEditor);
          Splitter1.Parent := xMyEditor;
          Splitter1.Visible := True;
          Splitter1.Align := alBottom;
          Splitter1.Height := 9;
          Splitter1.Color := clHighlight;
          Splitter1.Top := xMyEditor.GroupBox2.Top + xMyEditor.GroupBox2.Height;

          xMyEditor.ShowModal;
        finally
          xMyEditor.Free;
        end;
      end;
    end;
  end;
end;

 

Change Forms 2.png

Your showmessage does not trigger because you override constructor Create, but call constructor CreateEx.

Unfortunately, you cannot override CreateEx, because embarcadero does not made it virtual, but you can create your own additional constructor or class method which will call inherited CreateEx inside, or leave all code inside ExecuteVerb.

Edited by Softacom Company

Share this post


Link to post
1 minute ago, Softacom Company said:

Your showmessage does not trigger because you override constructor Create, but call constructor CreateEx.

Unfortunately, you cannot override CreateEx, because embarcadero does not made it virtual, but you can create your own additional constructor or class method which will call inherited CreateEx inside.


Can you create an example for my understanding?

Grateful.

Share this post


Link to post

Sure, it can be done like this:

...
type
  TMyImageCollectionEditorForm = class(TImageCollectionEditorForm)
  public
    constructor Create(AOwner: TComponent); override;
    constructor CreateAndInit(AImageCollection : TImageCollection); virtual;

    destructor Destroy; override;
  end;
...
constructor TMyImageCollectionEditorForm.CreateAndInit(
  AImageCollection: TImageCollection);
begin
  inherited CreateEx(nil, AImageCollection);
  BorderIcons := [biSystemMenu, biMaximize];

  GroupBox1.Margins.Top := 3;
  GroupBox1.Margins.Bottom := 3;
  GroupBox1.Margins.Left := 3;
  GroupBox1.Margins.Right := 10;

  GroupBox2.Margins.Top := 3;
  GroupBox2.Margins.Bottom := 3;
  GroupBox2.Margins.Left := 3;
  GroupBox2.Margins.Right := 10;

  var Splitter1 := TSplitter.Create(self);
  Splitter1.Parent := self;
  Splitter1.Visible := True;
  Splitter1.Align := alBottom;
  Splitter1.Height := 9;
  Splitter1.Color := clHighlight;
  Splitter1.Top := GroupBox2.Top + GroupBox2.Height;
end;

procedure TMyImageCollectionEditor.ExecuteVerb(Index: Integer);
begin
...
  var xMyEditor := TMyImageCollectionEditorForm.CreateAndInit(xImCol);
...
end;

P.S. Did you know that you can debug Design-Time packages? Just go Run->Parameters->HostApplication and pick there Delphi ( C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\bds.exe). It’s will raise few expected exceptions, but now when you will press F9 you will start another Delphi instance and debug your sources for design-time.  It will be better than using showmessages.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×