Developing new TEditButton types requires dclfmxst

2019-03-06 00:39发布

I am using Delphi Berlin Enterprise and I need to extend some functionalities of the TClearEditButton and TDropDownEditButton. So I developed my own TMEClearEditButton and TMEDropDownListEditButton. They are subclasses of the standard FireMonkey ones, so I used the FMX.Edit unit. I did some test by creating the buttons by code and had no problems up to here.

Problems started when I decided to build a designtime only package to have the possibility to add the buttons to edits directly in the IDE. Copying some code from FMX.Editors, I came up with the following:

Unit ME.Editors;

Interface

Uses
  System.Classes,
  DesignIntf,
  FMX.Editor.Items,
  FMX.Design.Items;

Type
  TMEEditEditor = Class(TItemsEditor)
  Public
    Constructor Create(AComponent: TComponent; ADesigner: IDesigner); Override;
  End;

Implementation

Uses
  FMX.Edit,
  ME.Edit;

Constructor TMEEditEditor.Create(AComponent: TComponent; ADesigner: IDesigner);
Begin
  Inherited Create(AComponent, ADesigner);
  FAllowChild := False;
  SetLength(FItemsClasses, 10);
  FItemsClasses[0] := TItemClassDesc.Create(TEditButton);
  FItemsClasses[1] := TItemClassDesc.Create(TMEClearEditButton);
  FItemsClasses[2] := TItemClassDesc.Create(TPasswordEditButton);
  FItemsClasses[3] := TItemClassDesc.Create(TSearchEditButton);
  FItemsClasses[4] := TItemClassDesc.Create(TEllipsesEditButton);
  FItemsClasses[5] := TItemClassDesc.Create(TDropDownEditButton);
  FItemsClasses[6] := TItemClassDesc.Create(TMEDropDownListEditButton);
  FItemsClasses[7] := TItemClassDesc.Create(TMEDropDownDateEditButton);
  FItemsClasses[8] := TItemClassDesc.Create(TMEDropDownTimeEditButton);
  FItemsClasses[9] := TItemClassDesc.Create(TSpinEditButton);
End;

End.

Now compiling this requires some standard delphi designtime packages:

  • DesignIDE
  • fmxdesigner
  • dclcommon

... but that does not seem to be enough. It now compiles, but with warning that the following units were implicitly imported into my package:

  • FMX.Design.Lang
  • FmxDsnConst
  • FMX.Editor.Items
  • FMX.Design.Items

... and suggesting I should add the dclfmxstd package to the requires list.

If I do so, it won't work because no dclfmxstd.dcp actually exists anywhere on my computer. There is a dclfmxstd240.bpl package library in my 18.0\bin directory, but no dcp compiled package anywhere.

I also tried to copy those 4 units in my development directory and include them explicitly in my package... but that won't work as it states that those units are already included in the dclfmxstd240 package.

Any hints as to how to get out of this empasse and move forward?

PS - As an aside... it would be nice to have a mapping of delphi units to packages so as to know which packages have to be referenced... without using a binary search tool on all the many dcps in Lib ;)

I have reported this issue on the Embarcadero QP (RSP-17686)

1条回答
我只想做你的唯一
2楼-- · 2019-03-06 01:06

I thought I'd post this as an answer because although it doesn't solve your problem in a very satisfactory way, I've at least got as far as deriving an FMX component which I can install in the IDE and which has a custom designer. What I've done might give you some ideas for where next.

Here's what I've done:

  1. I created a unit containing a minimal descendant of FMX's TEdit, TMyEdit. This uses the following FMX units: FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Controls.Presentation and FMX.Edit. I also created a separate unit (like you are supposed to) containing a minimal component edit. This unit only uses System.Classes, DesignIntf, FMX.Editor.Items and FMX.Design.Items.

  2. I added both of these units to a new .Dpk project and set its Requires clause to list RTL.DCP, FMX.DCP and FMXDesigner.DCP.

  3. I compiled the .Dpk and attempted to install it. I got the same dialog as you suggesting to add DclFMXStd.DCP to my Requires list. And then, of course, it complained that it couldn't find it.

  4. I searched my entire h/disk for DclFMXStd.* and of course it found nothing apart from DclFMXStd230.BPL, but no counterpart .DCP file.

  5. So then I wondered "Where is it getting the name 'DclFMXStd' from? A Grep search of my Seattle install (which is what I'm using, though I have Tokyo installed to) found that the only file that contains the name is the package file, DclFMXStd230.Bpl, which contains 3 occurrences of it. I confirmed this by running Delphi's TDump utility on the .Bpl.

  6. So then I thought 'What if I uninstall DclFMXStd230.Bpl from the IDE?'. I tried, and Presto, my package now compiles and installs without complaint, Although, of course, the IDE is now devoid of the supplied FMX components.

So, I think that would be enough to file a legitimate QP report, if I were in your position.

If you want to reinstate the other FMX components, I suppose you could think about adding them to your package, though you might want to check whether that is allowed under the terms of your Delphi licence.

The other thing I've been wondering is 'Surely, other FMX authors must have run into this problem, despite google only finding your SO posts? So it might be worth tracking down a preferably-freeware FMX library with source and looking at how the authors solve or avoid the problem.

Good luck!

查看更多
登录 后发表回答