简体   繁体   English

如何在delphi中使用fmx扩展

[英]How to use fmx extensions in delphi

I have an extension for a tabControl downloaded, im a newbie at delphi could somebody please tell me how i can make use of it in my current project. 我有一个tabControl下载的扩展,我是delphi的新手,有人可以请告诉我如何在我当前的项目中使用它。

I have downloaded the following file and saved it as FMX.Extensions.UX.TabControl in my project folder from here and added it to my uses on project1. 我已经下载了以下文件并将其保存为我的项目文件夹中的FMX.Extensions.UX.TabControl,并将其添加到我在project1上的用途。

TabControl Extension TabControl扩展

i have a project1 with a tabcontrol and a few simple items on each tab, can somebody help me in learning how to use this extension, i have no idea where to go from here. 我有一个带有tabcontrol的project1和每个标签上的一些简单项目,有人可以帮助我学习如何使用这个扩展,我不知道从哪里开始。

Kind Regards 亲切的问候

UPDATE: 更新:

I added this to my includes under form1. 我将此添加到form1下的包含中。

{$R *.fmx}
{$I 'FMX.Extensions.UX.TabControl.pas'}

But now when i try to compile the project in delphi XE5 i get the errors. 但是现在当我尝试在delphi XE5中编译项目时,我得到了错误。

[dcc32 Error] FMX.Extensions.UX.TabControl.pas(1): E2029 Declaration expected but 'UNIT' found
[dcc32 Error] FMX.Extensions.UX.TabControl.pas(53): E2003 Undeclared identifier: 'TIntAnimation'
[dcc32 Error] FMX.Extensions.UX.TabControl.pas(54): E2007 Constant or type identifier expected
[dcc32 Error] FMX.Extensions.UX.TabControl.pas(65): E2029 Declaration expected but 'IMPLEMENTATION' found
[dcc32 Fatal Error] FMX.Extensions.UX.TabControl.pas(65): E2226 Compilation terminated; too many errors

You need to first install the UX package. 您需要先安装UX软件包。 You can find it under Packages/ FMX.Extensions.UX.dproj. 您可以在Packages / FMX.Extensions.UX.dproj下找到它。 To install, open the package in the Delphi IDE then right click and select install. 要安装,请在Delphi IDE中打开包,然后右键单击并选择install。

You should also remove the line you added to the form ({$I 'FMX.Extensions.UX.TabControl.pas'}). 您还应该删除添加到表单中的行({$ I'FMX.Extensions.UX.TabControl.pas'})。

Disclaimer: I am the author of this component. 免责声明:我是该组件的作者。

To add a Delphi unit to you project you need to add it to one of the uses clauses in each unit file where it will be referenced. 要向项目中添加Delphi单元,需要将其添加到每个单元文件中的一个uses子句中,以便引用它。

The structure of a unit file is: 单元文件的结构是:

unit <unitname>;

interface
uses <files>;

//interface declarations

implementation
uses <files>;

//code here

end.

Each uses statement takes a comma separated list of unit names, so for you this would be 每个uses语句都使用逗号分隔的单元名列表,所以对你来说就是这样

uses FMX.Extensions.UX.TabControl;

As a general rule you should place the units in the uses statement of the implementation section unless anything in your interface section references it, in which case us that in your interface section. 作为一般规则,您应该将单元放在实现部分的uses语句中,除非您的接口部分中的任何内容引用它,在这种情况下我们在您的接口部分中。 Units referenced in your interface section can lead to issues with circular unit references. 接口部分中引用的单元可能导致循环单元引用问题。

Depending on where you save the file you may also need to add it's location to your library, either under Tools/Options/Delphi Options/Library/Library Path (for all projects) or Project/Options/Delphi Compiler/Search Path (current project only). 根据您保存文件的位置,您可能还需要将其位置添加到库中,可以在工具/选项/ Delphi选项/库/库路径(适用于所有项目)或项目/选项/ Delphi编译器/搜索路径(当前项目)下进行只要)。

(I would recommend saving third party code in it's own folder so you have a record of what code comes from where). (我建议将第三方代码保存在自己的文件夹中,这样您就可以记录哪些代码来自哪里)。

The code you are including adds components which are used at design time. 您所包含的代码添加了在设计时使用的组件。 These components need registering with the IDE, which @norgepaul has explained how to do. 这些组件需要注册IDE,@ norgepaul已经解释了如何操作。 If you use these components at design time then Delphi will add them to your uses clause for the form for you. 如果您在设计时使用这些组件,那么Delphi会将它们添加到您的表单的uses子句中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM