本文介绍了开发新的TEditButton类型需要dclfmxstd包,它不作为dcp存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用德尔福柏林企业版,我需要扩展TClearEditButton和TDropDownEditButton的一些功能。所以我开发了我自己的TMEClearEditButton和TMEDropDownListEditButton。它们是标准FireMonkey的子类,所以我使用了FMX.Edit单元。我做了一些测试,通过代码创建按钮,没有问题到这里。



当我决定构建一个仅设计时间包,有可能添加问题开始直接在IDE中编辑的按钮。从FMX.Editors复制一些代码,我想出了以下内容:

 单位ME.Editors; 

接口

使用
System.Classes,
DesignIntf​​,
FMX.Editor.Items,
FMX.Design。物品;

类型
TMEEditEditor =类(TItemsEditor)
Public
构造函数创建(AComponent:TComponent; ADesigner:IDesigner);覆盖;
结束;

实现

使用
FMX.Edit,
ME.Edit;

构造函数TMEEditEditor.Create(AComponent:TComponent; ADesigner:IDesigner);
开始
继承的Create(ACComponent,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);
结束;

结束。

现在编译需要一些标准的delphi设计时间包:




  • DesignIDE

  • fmxdesigner

  • dclcommon



...但似乎还不够。它现在编译,但警告,以下单位被隐式导入到我的包中:




  • FMX.Design.Lang

  • FmxDsnConst

  • FMX.Editor.Items

  • FMX.Design.Items



...并建议我应该将 dclfmxstd 包添加到需求列表中。



如果我这样做,它将无法工作,因为没有dclfmxstd.dcp实际上存在于我的计算机上的任何地方。我的18.0\bin目录中有一个dclfmxstd240.bpl软件包库,但没有任何dcp编译包。



我也试图在开发目录中复制这4个单元并将它们明确地包含在我的包中...但是这不会起作用,因为它表示这些单元已经包含在 dclfmxstd240 包中。



任何关于如何摆脱这个问题的提示,向前推进?



PS - 除了...很高兴将delphi单元映射到软件包,以便知道哪些软件包必须被引用...而不使用Lib中的所有许多dcps的二进制搜索工具;)



我已经在Embarcadero QP(RSP-17686)上报了这个

解决方案

我以为我会发布这个作为一个答案,因为虽然它不能很好地解决你的问题令人满意的方式,我至少得到一个派生一个FMX组件,我可以安装在IDE中,并有一个自定义设计器。我做了什么可能会给你一些下一个想法。



这是我做了什么:


  1. 我创建了一个包含FMX TEdit,TMyEdit的最小后裔的单位。这使用以下FMX单元:FMX.Types,FMX.Controls,FMX.Forms,FMX.Graphics,FMX.Dialogs,FMX.Controls.Presentation和FMX.Edit。
    我还创建了一个单独的单元(如你应该)包含一个最小的组件编辑。本机只使用System.Classes,DesignIntf​​,FMX.Editor.Items和FMX.Design.Items。


  2. 我将这两个单元都添加到新的单元中。 Dpk项目并设置其要求子句列出RTL.DCP,FMX.DCP和FMXDesigner.DCP。


  3. 我编译了.dpk并尝试安装它。我建议将DclFMXStd.DCP添加到我的需求列表中。然后,当然,它抱怨说它找不到它。


  4. 我搜索了我的整个h / disk DclFMXStd。除了DclFMXStd230.BPL,但没有对应的.DCP文件。


  5. 那么我想知道从哪里获取名称DclFMXStd?搜索我的西雅图安装(这是我正在使用,虽然我有东京安装)发现唯一包含该名称的文件是包文件DclFMXStd230.Bpl,其中包含3次发生,我确认了在.Bpl上运行Delphi的TDump实用程序。


  6. 那么我以为'如果我从IDE中卸载DclFMXStd230.Bpl怎么办?'我试过,Presto ,我的包现在编译和安装没有投诉,虽然当然,IDE现在没有提供的FMX组件。


所以,如果我处于你的位置,我认为这是足够的,可以提交合法的QP报告。



如果y ou想要恢复其他FMX组件,我想你可以考虑将它们添加到您的包中,尽管您可能希望根据您的Delphi许可证的条款来检查是否允许。


$ b $我曾经想过的另一件事是其他的FMX作者肯定遇到这个问题,尽管google只找到你的SO帖子?所以可能值得跟踪源代码的最佳免费的FMX库,并查看作者如何解决或避免问题。



祝你好运!


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)

解决方案

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!

这篇关于开发新的TEditButton类型需要dclfmxstd包,它不作为dcp存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 16:01