再谈 Delphi 的 LiveBindings 绑定界面元素和对象

TMS Pack for FireMonkey2.3.0.1 ********************************************************************** Author: TMS Software Copyright ?1996-2014 E-mail: info@tmssoftware.com Web: http://www.tmssoftware.com ********************************************************************** TMS Pack for FireMonkey TMS Pack for FireMonkey contains components for use in user interfaces designed with the Embarcadero FireMonkey framework. The components have been designed from the ground up based on the core concepts of the FireMonkey framework: made up of styles, fully cross-platform, scalable and compatible with FireMonkey抯 effects, rotation, livebindings. Release 2.3.0.1: ----------------- Highly styleable cross-platform FireMonkey controls Support for Windows 32 bit, 64 bit, Mac OS X, iOS and Android Support for HTML formatted text, including hyperlinks in various parts of the components Built-in support for LiveBindings in TTMSFMXTableView and TTMSFMXTileList, allows to bind any item element to data Includes various demos and an extensive PDF developers guide Includes various helper controls (badge, button and html enabled text controls) that can be used separately as well Includes several Sample applications for the TTMSFMXGrid component History : --------- v1.0 : first release v1.0.0.1 Fixed : Issue with setting the focus on the form (Can be activated / deactivated with ShowActivated property) in TTMSFMXPopup Fixed : Issue with BitmapContainer assignment V1.1.0.0 New : Introducing TTMSFMXSpeedButton New : Introducing TTMSFMXHotSpotImage with separate editor Improved : TMSIOS Define Fixed : Issue with initial state when State is ssOn in TTMSFMXSlider Fixed : Issue with Opacity in HTML Drawing in TTMSFMXHTMLText v1.1.0.1 Fixed : Issue with parent in TTMSFMXPopup v1.1.0.2 Fixed : Issue with lfm file missing in package v1.1.0.3 New : Support for update 4 hotfix 1 Fixed : Issue with order of freeing objects in TTMSFMXTableView v1.1.0.4 Fixed : Issue with state changing with mouse out of bounds in TTMSFMXSlider Fixed : Issue with resizing detail view in TTMSFMXTableView v1.5.0.0 New : Components TTMSFMXGrid, TTMSFMXNavBar, TTMSFMXEdit and TTMSFMXEditBtn, TTMSFMXProgressBar New : Helper components: TTMSFMXGridPrintPreview, TTMSFMXFindDialog, TTMSFMXReplaceDialog, TTMSFMXExcelIO, TTMSFMXRTFIO. Improved : Performance for handling hover & click of hotspots in TTMSFMXHotSpotImage Fixed : Issue with mouse capturing in TTMSFMXTableView Fixed : Issue with alignment and resizing of detail view container when item has no detail view assigned in TTMSFMXTableview v1.6.0.0 New : XE3 Support New : OnSearchOpen / OnSearchClose called when swiping done or showing the filter with the ShowFilter property in TMSFMXTableView New : OnCanColumnDrag, OnCanRowDrag events added in TTMSFMXGrid New : OnColumnDragged, OnRowDragged events added in TTMSFMXGrid New : LiveBindings support in TTMSFMXGrid Fixed : Issue with Options.Mouse.ColumnDragging = false / Options.Mouse.RowDragging = false in TTMSFMXGrid Fixed : Issue with OnCanInsertRow/OnCanDeleteRow triggering in TTMSFMXGrid Fixed : Issue with selection on top when dragging in touch mode in TTMSFMXGrid Fixed : Access violation when touching outside the grid in touch mode in TTMSFMXGrid Fixed : Enabling touch mode in none selection mode in TTMSFMXGrid Fixed : Issue with OnClick / OnDblClick in instrumentation components Fixed : Issue with scrolling and selecting value in iOS in TTMSFMXSpinner Fixed : Issue with escape key not cancelling edit mode in TTMSFMXGrid v1.6.0.1 Fixed : Issue with double databinding registration in XE2 ios package v1.7.0.0 : New : added components TTMSFMXCalendar and TTMSFMXCalendarPicker New : Fixed cell single and range selection in TTMSFMXGrid New : Autosizing columns / rows on double-click in TTMSFMXGrid New : Column persistence in TTMSFMXGrid Improved : Data reset when toggling active in TTMSFMXScope Fixed : Issue with checkbox and radiobutton not rendering correctly on iOS project in TTMSFMXGrid Fixed : Issue with accessing and adding progressbar cells in TTMSFMXGrid Fixed : Repaint bug in XE3 in TTMSFMXTileList Fixed : ShowGroupGount implement in TTMSFMXGrid Fixed : GroupCountFormat implemented in TTMSFMXGrid Fixed : Issue with memoryleak in TTMSFMXLedBar Fixed : Access violation when clicking edit button in TTMSFMXTableView Fixed : Issue with OnDblClick not triggered in TTMSFMXTableView Fixed : Issue with popupmenu on background interfering with scrolling interaction in TTMSFMXTableView Fixed : Issue with selection persistence of items when scrolling in TTMSFMXTableView Fixed : Access violation Loading footer at designtime in TTMSFMXPanel v1.7.5.0 New: Capability to export multiple grids to a single RTF file in TTMSFMXGridRtfIO New : Options.Filtering.MultiColumn added to perform automatic multicolumn filtering in TTMSFMXGrid Fixed : Issue with Delphi XE3 compatibility in TTMSFMXCalendar Fixed : Issue with ApplyPlacement for plTop/plTopCenter in TTMSFMXPopup Fixed : Issue with sorting & filtering in TTMSFMXGrid Fixed : Issue with InsertRow on non-initialized grid in TTMSFMXGrid Fixed : Issue with XE3 Mac filtering in TTMSFMXGrid v1.7.5.1 Fixed : Issue with anchor detection when scrolling in TTMSFMXGrid Fixed : Issue with ccCount column calc in TTMSFMXGrid v1.7.5.2 New : Exposed functions CancelEdit / StopEdit in TTMSFMXGrid Fixed : Issue with text initialization in constructor in TTMSFMXGrid Fixed : Issue with default values for ArrowHeight and ArrowWidth in TTMSFMXPopup Fixed : Issue with focusing calendar in TTMSFMXCalendar Fixed : Issue with lookuplist in TTMSFMXEdit in XE3 Fixed : Issue with absoluteopacity in TTMSFMXLED v1.8.0.0 New : PDF Export component for Windows (QuickPDF), Mac and iOS v1.8.0.1 Fixed : Issue with absolute opacity in TTMSFMXBitmap Fixed : Issue with editing cell functionality while selecting all cells in TTMSFMXGrid v1.8.0.2 Fixed : Issue with peristing column states Fixed : Issue with printing DPI on different real and virtual printers v1.8.0.3 Fixed : Issue with dblclick in TTMSFMXGrid Fixed : Issue with dropdown window visible after editing in TTMSFMXGrid Fixed : Issue with wordwrapping and strikeout font style in html engine v1.8.0.4 : Fixed : Issue with debug message in TTMSFMXGrid v1.8.0.5 Fixed : Issue with dblclick focusing issue in TTMSFMXGrid Improved : comment popup in cell configurable in TTMSFMXGridCell v1.8.0.6 Improved : PDF Export engine v1.8.0.7 Package build options change v1.8.0.8 Fixed : Issue with text repainting at runtime in TTMSFMXHTMLText Fixed : Issue with text fill color initialization in TTMSFMXHTMLText Fixed : Repaint bug in XE3 in drag/drop tiles in TTMSFMXTileList Fixed : Issue with memoryleak when reparenting items in TTMSFMXTableView Fixed : Issue with hidden radio button checked property in TTMSFMXGrid v1.8.1.0 Fixed : Issue with clipboard on empty grid in TTMSFMXGrid New : Event OnTopLeftChanged event v1.8.1.1 Improved : block refreshing columns when destroying the component in TTMSFMXSpinner Fixed : Small issue in HTML Rendering engine for anchor rendering in TTMSFMXHTMLEngine Fixed : Issue with hidecolumn in TTMSFMXGrid v1.8.1.2 Issue with C++Builder OSX library paths not updated when installing v1.8.1.3 Issue compilation in FPC with TMSPlatforms constant v1.8.1.4 Improved : Added Event OnCellEditCancel in TTMSFMXGrid Improved : OnTileAnchorClick event exposed in TTMSFMXTileList Improved : Escape key handling in TTMSFMXCalendarPicker to cancel date selection Fixed : Issue with TMSFMXEdit signed float Fixed : Issue with dblclick in TTMSFMXEdit Fixed : Issue with dropdown access violation in TTMSFMXEdit Fixed : Access violation in TTMSFMXPopup v2.0.0.0 New : Syntax highlighting and editing component TTMSFMXMemo New : Persisted Columns collection in TTMSFMXGrid New : KeyBoard and Mouse Wheel handling support in TTMSFMXSpinner Improved : Escape to cancel date selection and return to previous selected date in TTMSFMXCalendar Fixed: Issue with autosizing and client-aligned captions v2.0.1.0 New : Pointer direction property in TTMSFMXBarButton Fixed : Issue with repainting header and footer text in TTMSFMXTableView Fixed : Selection changed notification to observer in TTMSFMXTableView Fixed : Issue with list read access in TTMSFMXNavBar Fixed : incorrect Gutter behavior when gutter is visible false or width = 0 in TTMSFMXMemo Fixed : Issue with XE2 FMI package memo registration v2.0.1.1 Fixed : Issue with height of tabs in TTMSFMXNavBar v2.0.2.0 New : OnButtonClick event in TTMSFMXEditBtn Fixed : Issue with fixed cell property persistence in TTMSFMXGrid Fixed : Issue with Excel font color import in TTMSFMXGrid Fixed : Issue with border width in new columns persistence collection in TTMSFMXGrid Fixed : Issue with bitmap assignment in TTMSFMXTableView Fixed : Issue with clearing cells in TTMSFMXGrid v2.0.2.1 Fixed : Issue with anchors & readonly cells in TTMSFMXGrid Fixed : Issue with handling Columns[x].ReadOnly Improved : Published events for Find and Replaced dialog in TTMSFMXMemo v2.1.0.0 New : XE4 support Fixed : Issue with memory leak in TTMSFMXGrid Fixed : Issue with triggering OnCursorChange in TTMSFMXMemo Fixed : Issue with UpdateMemo call when client-aligning Fixed : Issue with index out of bounds in empty grid connected to dataset v2.1.0.1 Improved : NextPage and PreviousPage methods in TTMSFMXGrid Fixed : Issue compiling demo's in trial version Fixed : Issue with LoadFromFile column widths in TTMSFMXGrid v2.1.0.2 Improved : GetTextHeight function in TTMSFMXHTMLText Fixed : Issue with iOS cell objects not being freed in TTMSFMXGrid Fixed : Issue with Scrolling when scrollbars are not visible in TTMSFMXGrid Fixed : Issue with readonly cells when using columns in TTMSFMXGrid Fixed : Issue accessing correct cell colors in TTMSFMXGrid Fixed : Issue with displaying DetailView in TTMSFMXTableView v2.1.0.3 Improved : Added Fixed Disjunct Row and Column Selection in TTMSFMXGrid Fixed : Issue with LiveBindings editing and row selection in TTMSFMXGrid Fixed : Replacement for TScrollBox issues at designtime / runtime. Fixed : Issue with Form Key handling in TTMSFMXEdit Fixed : Issue with designtime initialization of caption in TTMSFMXPanel Fixed : Issue with autocompletion popup in TTMSFMXMemo Fixed : Issue with font persistence in TTMSFMXMemo Fixed : Issue with ShowImage in TTMSFMXBarButton Fixed : Issue on iOS with categories in TTMSFMXTableView v2.1.0.4 Fixed : Issue with grid editing / inserting in LiveBindings in TTMSFMXGrid v2.1.0.5 Fixed : Memory leak with panel list in TTMSFMXNavBar Fixed : Access violation in TTMSFMXMemo v2.1.1.0 New : VisibleRowCount and VisibleColumnCount functionality in TTMSFMXGrid Fixed : Issue with disjunct selection and sorting in TTMSFMXGrid v2.1.1.2 New : LiveBinding support for Notes in TTMSFMXTileList v2.1.1.3 New : Published Anchors property Fixed : Issue inserting and deleting records in LiveBindings in TTMSFMXGrid v2.1.1.4 Fixed : Issue with RadioButtons in TTMSFMXGrid Fixed : Issue with Text position and width in TTMSFMXRotarySwitch v2.1.1.5 Fixed : Issue with rtf exporting on iOS in TTMSFMXGrid Fixed : Issue with ColumnStatesToString and column swapping in TTMSFMXGrid Fixed : Issue with lookup list on Mac in TTMSFMXEdit v2.1.1.6 Fixed : Issue with assign procedure collection item in TTMSFMXTableView Fixed : Issue with TTMSFMXPopup component on the form already exists v2.1.1.7 Improved: Assign() handling in TTMSFMXTableView Improved : conditionally use XOpenURL or XOpenFile for cell anchors in TTMSFMXGrid Fixed : Issue with Padding vs Margins in TTMSFMXPageSlider Fixed : Issue with comment resizing in TTMSFMXGrid Fixed : Issue with TableView resizing in TTMSFMXTableView Fixed : issue with column alignment settings for cell states different from normal in TTMSFMXGrid Fixed: Do not set TopMost = true in GetStyleObject, interferes with use on a popup in TTMSFMXEdit Fixed : Issue with initialization years in popup picker in TTMSFMXCalendarPicker Fixed : issue with setting Collaps = true at design time in TTMSFMXPanel Fixed : Issue with pressing ESC when date is empty in TTMSFMXCalendarPicker v2.2.0.0 New : XE5 support New : Android support New : Width and Height properties on lookup list in TTMSFMXEdit New : Redesign of TTMSFMXPopup to support iOS / Android Fixed : Issue with lookup autosize calculation in TTMSFMXEdit Fixed : Hints in TTMSFMXHTMLText and TTMSFMXBitmap Fixed : Issue with OnColumnSorted event not triggered in TTMSFMXGrid v2.2.0.1 Fixed : Issue with deleting rows in TTMSFMXGrid Fixed : Issue with date parsing in TTMSFMXCalendar Fixed : CSV parsing on iOS / Android in TTMSFMXGrid v2.2.1.0 New : OnMonthChanged and OnYearChanged events in TTMSFMXCalendar Fixed : Issue with money editing in TTMSFMXGrid v2.2.1.1 Fixed : Issue with disposing objects on iOS in TTMSFMXGrid Fixed : Issue with items return with incorrect CategoryID in TTMSFMXTableView v2.2.1.2 Fixed : Issue with column moving & column sizes in TTMSFMXGrid Fixed : Issue with save to file & linebreaks on iOS / Android in TTMSFMXGrid Fixed : Issue with column, row dragging out of the grid boundaries in TTMSFMXGrid Fixed : Issue with resizing in TTMSFMXTableView v2.2.1.3 Fixed : Issue with scrollbox and applystyle empty text initialization in TTMSFMXEdit Fixed : Issue with string conversion on iOS / Android in TTMSFMXGrid Fixed : Issue with column, row dragging out of the grid boundaries in TTMSFMXGrid Fixed : Issue with Livebindings in TTMSFMXCalendarPicker v2.2.1.4 Fixed : Issue with badge in TTMSFMXTileList Fixed : Issue with row sorting and objects in TTMSFMXGrid v2.2.2.0 Improved : Disjunct deselection of column, rows and cells in TTMSFMXGrid Fixed : Issue with horizontal scrolling and text trimming in TTMSFMXMemo Fixed : Issue with displaylist on XE5 in TTMSFMXEdit Fixed : Issue with assignment of item an OnItemClick in TTMSFMXTableView Fixed : Floating point division by zero in TTMSFMXPopup Fixed : Issue with OnCellEditDone event and focus changes v2.2.2.1 Fixed: Issue with Keyboard handling for ComboBox editor type in TTMSFMXGrid v2.2.2.2 Fixed : Issue with saving hotspot images in TTMSFMXHotSpotImage Fixed : Issue with memo find & replace dialog up and down search in TTMSFMXMemo Fixed : Issue with naming for led elements in TTMSFMX7SegLed Fixed : Issue with mouse enter/leave in TTMSFMXCalendar Fixed : Issue with column hiding and memory leak in sorting data in TTMSFMXGrid v2.2.2.3 Fixed : Issue with column/row hiding combinations in TTMSFMXGrid Fixed : Issue with Escape key in TTMSFMXGrid v2.2.2.4 Fixed : Issues with column/row handling in TTMSFMXGrid Fixed : Issue with calculation setpoints, needles and sections with minimumvalue > 0 in TTMSFMXLinearGauge v2.2.2.5 Improved: Signed numeric not being handled in GetInt/SetInt in TTMSFMXEdit Fixed: Issue with unhiding row combinations in TTMSFMXGrid v2.2.2.6 Improved : OnFormatCellDataExpression in TTMSFMXGrid Fixed : Issue with selection initialization in TTMSFMXGrid Fixed : Issue with cell creation in xls export v2.2.2.7 Fixed : Issue with using semi opaque hover, selected, down color in TTMSHotSpotImage Fixed : Issue with row insertion in TTMSFMXGrid v2.2.2.8 Fixed : Issue with grouping / ungrouping and row / column insertion changes v2.2.2.9 Improved : Clearing grid offset in TTMSFMXScope Fixed : Issue with initializing grid with default no. columns in TTMSFMXGrid Fixed : Issue with adding data without animation in TTMSFMXScope v2.3.0.0 New : XE6 Support v2.3.0.1 Fixed : XE6 Style compatibility issues Usage: ------ Use of TMS software components in applications requires a license. A license can be obtained by registration. A single developer license registration is available as well as a site license. With the purchase of one single developer license, one developer in the company is entitled to: - use of registered version that contains full source code and no limitations - free updates for a full version cycle - free email priority support & access to support newsgroups - discounts to purchases of other products With a site license, multiple developers in the company are entitled to: - use of registered version that contains full source code and no limitations - add additional developers at any time who make use of the components - free updates for a full version cycle - free email priority support & access to support newsgroups - discounts to purchases of other products Online order information can be found at: http://www.tmssoftware.com/go/?orders Note: ----- The components are also part of the TMS Component Pack bundle, see http://www.tmssoftware.com/go/?tmspack Help, hints, tips, bug reports: ------------------------------- Send any questions/remarks/suggestions to : help@tmssoftware.com Before contacting support about a possible issue with the component you encounter, make sure that you are using the latest version of the component. If a problem persists with the latest version, provide information about which Delphi or C++Builder version you are using as well as the operating system and if possible, steps to reproduce the problem you encounter. That will guarantee the fastest turnaround times for your support case. 立即下载

前言:

本博客前面有文章描述过如何将一个对象的属性和界面元素(比如,Label1)绑定。那篇文章写得有点复杂。这里简化一下操作过程的描述。

Delphi 版本:

Delphi 10.4 社区版。

操作方法:

1. 假设有一个类定义:

TMyDev = class
  private
    FDevID: string;
    FDevName: string;
    FIsOnline: Integer;
    FIsSelected: Integer;
  public
    property DevID: string read FDevID write FDevID;
    property DevName: string read FDevName write FDevName;
    property IsOnline: Integer read FIsOnline write FIsOnline;
    property IsSelected: Integer read FIsSelected write FIsSelected;
  end;

2. 在 Form1 上面,有一个 Label1;

3. 有一个 Form1 的全局对象 FDev: TMyDev;

4. 拖一个 AdapterBindSource1 到 Form1 上面。拖一个 DataGeneratorAdapter1 到 Form1 上面。

5. 右键点击 DataGeneratorAdapter1 选择下拉菜单 Fields Editor;

6. 在 Fields Editor 窗口里面,增加字段。字段的名字和 TMyDEV 的属性名字相同,数据类型相同。

7. AdapterBindSource1 的 Adapter 的属性,在属性选择框里面,下拉,选择 DataGeneratorAdapter1。

8. 对 DataGeneratorAdapter1 和 AdapterBindSource1 的设置完成,鼠标右键点击 Form1 在下拉菜单里面选择 Bind Visually,IDE 底部会出现可视化绑定的窗口。

9. 在可视化绑定的窗口里面,找到 Label1,会显示它的 TEXT 属性;找到 AdapterBindSource1,会显示之前在 DataGeneratorAdapter1 里面添加的字段。点击 Label1 的 TEXT 拉线到  AdapterBindSource1 里面的某一个字段,这里我选择 DevName 字段。

10. 开始写代码:在 Form1 上面找到 AdapterBindSource1 选择它,然后在属性面板的 Events 事件页里面,找到事件(这里只有一个事件 OnCreateAdapter),双击这个事件,IDE 产生代码框架,代码如下:

procedure TForm1.AdapterBindSource1CreateAdapter(Sender: TObject;
  var ABindSourceAdapter: TBindSourceAdapter);
begin
  if not Assigned(FDev) then FDev := TMyDev.Create;

  FDev.FDevID := 'ID-893545';
  FDev.FDevName := 'Name - MyBLE';
  FDev.FIsOnline := 0;
  FDev.FIsSelected := 1;

  ABindSourceAdapter := TObjectBindSourceAdapter<TMyDev>.Create(AdapterBindSource1,
                                                               FDev, True);

  ABindSourceAdapter.AutoPost := False;

end;

11. 在 DELPHI IDE 里按 F9 运行程序,程序编译运行起来后,可以看到 Label1 显示的是上面的代码里面的 DevName 的值;

12. 增加一个按钮和一个 Edit1,运行期修改对象的属性值,看看 Label1 显示的内容是否跟随变化:

procedure TForm1.Button1Click(Sender: TObject);
begin
  FDev.DevName := Edit1.Text;
  AdapterBindSource1.Refresh; //修改完对象的值后,必须执行一次 Refresh 否则界面元素 Label1.Text 没有跟随变化。
end;

13. 拖一个 Edit2 到 Form1 上,进入可视化绑定界面(鼠标右键点击 Form1 下拉菜单选择 Bind Visually),在可视化绑定界面里面,找到 Edit2,鼠标左键点下它的 TEXT 属性,拉线到AdapterBindSource1 的 DevName 字段上,建立绑定连接。此时,Label1 的 Text 属性和 Edit2 的 Text  属性,都拉线连接到 AdapterBindSource1 的 DevName 字段上面。

14. 按 F9 编译运行,此时,Label1 和 Edit2 都显示相同的内容,都是 FDev.DevName 的内容。然后在 Edit2 里面输入一些新的内容,按回车,可以看到 Label1 显示的内容变成了 Edit2 里面输入的新的字符串。这里,实际上是 Edit2 的 Text 被用户输入改变后,回车就直接改变了绑定的 AdapterBindSource1 对应的 DevName 字段的值,然后绑定到这个字段的 Label1.Text 也就跟随改变了。

总结:

设计期在 IDE 里面可视化将对象的属性值绑定到界面元素的基本框架:

1. 自己用代码定义的类,属性值是 Public 的;

2. 拖一个 DataGeneratorAdapter1 到界面上,打开它的 Fields Editor 增加字段,字段名和数据类型和类的属性名相同。

3. 拖一个 AdapterBindSource1 到界面上,指定它的 Adapter 是 DataGeneratorAdapter1;

4. 打开设计期可视化绑定的界面,做了 2,3 两步,这时候就可以在这里看到 AdapterBindSource1 有字段了,用鼠标把字段和对应的界面元素(比如 Label1)拉线连接。

5. 增加 AdapterBindSource1.OnCreateAdapter 事件的代码,主要是要在这里为它创建运行期的 Adapter:

ABindSourceAdapter := TObjectBindSourceAdapter<TMyDev>.Create(AdapterBindSource1,
                                                               FDev, True);

6. 当然,在这行代码前面,需要先创建 FDev 对象。

7. 看起来,设计期的 DataGeneratorAdapter1 仅仅是用于设计期可视化拉线用。因为设计期没有运行代码,Delphi IDE 是无法知道我们自己定义的类以及这个类有哪些属性的。

Delphi-Live-Bindings LiveBindings are a technique to bind Data to a Component. Delphi LiveBindings 介绍。 立即下载

相关推荐

EhLib.VCL 9.5 for Delphi 10.4.zip

亲测,可以支持delphi 10.4 自动安装,顺利,无错编译 Ehlib一款非常不错的第三方Grid控件。界面美观、功能强劲、内含编程时最常用的Delphi控件和源码,比Delphi自带的强大许多、比cxGrid小巧、使用起来更简单方便。 注意: 如果你的Delphi是安装的绿色版,会遇到EhLib270.dpk(33) Fatal: E2202 Required package 'rtl' not found。的错误。解决办法是找到Delphi安装位置的bin目录内的dcc32.cfg和dcc64.cfg把里面的路径修改成你安装的Delphi的实际路径就可以了。

【Delphi】Delphi 中的 LiveBindings 使用场景与概念

LiveBindings 适用于需要快速绑定 UI 控件和数据源的场景,尤其在数据库应用、对象模型绑定等场景中发挥作用。你可以使用 LiveBindings Designer 进行可视化的绑定,也可以通过代码实现更灵活的绑定。LiveBindings 既支持数据库字段的绑定,也支持普通对象和列表的绑定。LiveBindings 通过提供一种灵活、动态的数据绑定机制,极大地简化了 Delphi 应用程序中的数据交互。

sensor_WU 博客 1554

Delphi响应式编程革命:LiveBindings与Observable模式深度融合.pdf

文档支持目录章节跳转同时还支持阅读器左侧大纲显示和章节快速定位,文档内容完整、条理清晰。文档内所有文字、图表、函数、目录等元素均显示正常,无任何异常情况,敬请您放心查阅与使用。文档仅供学习参考,请勿用作商业用途。 如果你正在寻找一种高效、强大的编程语言来开发跨平台应用,那么Delphi绝对值得考虑!它拥有直观的可视化开发环境,让代码编写变得轻松简单。凭借着快速的编译速度和卓越的性能优化,Delphi能够帮助开发者迅速构建出高质量的应用程序。无论是Windows、macOS、iOS还是Android平台,Delphi都能完美支持,真正实现一次编写,多平台部署。选择Delphi,开启高效开发之旅!

(原创) Delphi中LiveBinding 绑定非数据库类数据的时候显示字段自定义名称(一)

DELPHI默认下,Grid控件通过TAdapterBindSource绑定到一个TObjectList<TObject>列表时,Grid的Header显示的是TObject的属性名称。不能像绑定数据集时显示自定义名称,我们来看看其是怎么实现的。 Grid是如何绑定数据的,通过Grid的绑定类TLinkGridToDataSource,追踪到单元Data.Bind.Grid.pas。TCustomLinkGridToDataSource本身没什么相关的方法,其父类是TCustomLinkGri

舞天涯的专栏 807

无人机基本组成部件

无人机基本组成部件

qq_37410522的博客 1万+

Hypermesh静力学仿真分析与模态分析-02

hypermesh中对较复杂实体进行静力学分析和模态分析,包含材料属性添加,载荷设置等等

Look_forward_的博客 6781

Delphi 利用LiveBindings绑定JSON数据到列表控件

为了提供数据绑定方案,Delphi FMX 框架提供了 LiveBindings 的技术。LiveBindings 基本上是一种基于表达式的机制,其中通常有一个源组件和一个目标组件,目的是将一个或多个涉及源成员的表达式绑定到目标的一个或多个属性。为了实现这一点,系统需要在某个地方存储涉及组件(在表单、框架或数据模块中)的绑定表达式集合(TBindingList 组件)。为了使数据对表达式引擎可用,您需要使用中间组件(BindSources)在表达式引擎和实际数据存储之间充当中介。

longchanghua_enshi的专栏 1032

Windows报错“The system cannot find the file specified“的PATH环境变量解决方案

摘要: Windows系统中出现"The system cannot find the file specified"错误通常因PATH环境变量配置问题导致。本文提供解决方案:1)检查并修正PATH变量(通过命令行或图形界面添加缺失路径);2)确认程序安装路径及拼写无误;3)恢复误改的系统变量。示例演示了Python路径配置及无效路径清理方法,建议谨慎修改变量、使用绝对路径并定期检查。附参考表格详述操作步骤,帮助用户高效解决问题并优化系统环境。

shejizuopin的博客 3518

LiveBindings 绑定界面元素和存储数据的对象

Delphi 的 LiveBindings 的例子,绑定数据库控件 TDataSet 的比较多。对于 TDataSet 来说,用 LiveBindings 框架,只是可以让更多的非 TDBEdit ... 这样的数据敏感控件,可以用来显示数据。 对于 FireMonkey 来说,已经没有了数据敏感控件,要绑定数据库,只能使用 LiveBindings 框架了。 除了数据库,如果数据源是对象,该...

pcplayer的博客 2704

手把手教你解决Keil5安装时xerces-c_3_0.dll缺失和0xc000007b报错(附文件下载与路径设置)

本文详细解析了Keil5安装过程中常见的xerces-c_3_0.dll缺失和0xc000007b报错问题,提供了从文件获取、路径设置到系统配置的完整解决方案。同时,文章还涵盖了STM32开发环境的搭建技巧和最佳实践,帮助开发者快速构建稳定的嵌入式开发环境。

weixin_29164497的博客 604

企业如何利用群晖 NAS 构建高效数据备份与容灾体系

群晖 NAS 不仅是一个企业级文件存储设备,更是一个完整的数据保护平台。通过 Active Backup for Business、快照技术和多层次容灾方案,企业可以在确保数据安全的同时,实现业务的高可用与持续性。在当今充满不确定性的环境下,企业应将数据备份与容灾体系作为 IT 战略的重要组成部分,而群晖 NAS 则是一个值得信赖的核心基石。

Trihawk的博客 492

【Delphi】中的数据绑定(LiveBindings)

介绍Delphi中的数据绑定概念

sensor_WU 博客 2033

主流双目相机技术参数横向评测:从ZED到INDEMIND的深度解析

本文对主流双目相机进行了深度横向评测,涵盖ZED、Bumblebee、Leap Motion、DUO 3D及INDEMIND等国内外产品。文章详细解析了分辨率、帧率、视场角、基线等核心参数,并结合科研、机器人导航、无人机、工业检测等典型应用场景,提供了实战选型指南,帮助读者根据具体需求挑选最合适的双目视觉解决方案。

weixin_29212867的博客 641

TAdapterBindSource实战:Delphi LiveBindings对象绑定指南

在桌面应用开发中,界面控件与业务对象的数据同步是高频需求,传统手动赋值方式代码冗余且易错。Delphi 提供的 LiveBindings 框架是一套基于 RTTI 的自动双向同步机制,通过源、目标、方向、表达式四要素,在控件与数据之间建立通知通道。TAdapterBindSource 作为对象绑定中的核心适配组件,能将内存中的业务对象翻译为 LiveBindings 可识别的字段集合,实现 UI 层与业务模型的深度解耦。这种设计不仅消除了大量赋值与刷新样板代码,还让表单编辑、详情页、配置面板等单对象多字段场

weixin_30219613的博客 223

ubuntu20.04下内核源码下载分析

ubuntu 20.04下内核源代码下载,配置编译环境写在前面一、安装VMware Workstation和Ubuntu20.04二、修改apt源合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 写在前面 我最近的科研工作需要使用到对ubun

冰冻三尺非一日之寒 1万+

从开发到生产:Power APP 的应用和编程实践

一旦您在开发环境中完成了应用程序的开发、调试和测试,就可以将其部署到生产环境中供用户使用。在 Power APP Studio 中,您可以选择将应用程序发布到 Power APP 网关或将其嵌入到其他应用程序中。使用 Power APP Studio 内置的调试工具,您可以逐步执行应用程序并查看变量的值,以确保逻辑的正确性。在上述代码中,我们通过将两个文本输入框(TextInput1 和 TextInput2)中的文本转换为数字,并将它们相加,将结果存储在 Result 变量中。

2301_79326510的博客 1504

LiveBindings对象绑定:TAdapterBindSource实战

数据绑定是界面开发中连接数据与控件的关键机制,Delphi的LiveBindings框架通过字段抽象实现UI与数据源解耦。然而面对内存业务对象(如TUser、TOrder),传统数据集绑定无从下手。TAdapterBindSource正是为这类场景设计的桥梁:它借助FieldDefs定义字段,配合OnGetFieldValue/OnSetFieldValue事件完成对象属性与字段的双向映射,让普通对象也能像数据集一样被界面识别。借助RTTI与TListBindSourceAdapter<T>,还能进一步将对

weixin_28746457的博客 302

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

一步一步学习使用LiveBindings(16)使用代码创建LiveBindings绑定

本文介绍了在Delphi中使用代码创建LiveBindings绑定的方法,重点包括: LiveBindings与VCL数据绑定的核心差异:LiveBindings是独立类,通过表达式引擎实现数据感知,而VCL使用DataLinks机制。 编程创建绑定的两种方式: 使用TLinkControlToProperty类创建控件到属性的绑定 使用TBindExpression类创建表达式绑定 FluentLiveBindings辅助单元的使用: 通过链式语法简化绑定代码 支持双向绑定、格式化和跟踪等功能 内部通过接

weixin_55010563的博客 1072

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

FireMonkey TListView 使用 LiveBindings 绑定 TObjectList

前言: Delphi FireMonkey 的 LiveBindings 可以用来直接绑定界面元素和一个对象的属性,这样就可以把对象的值显示到界面上。常见的是将数据库 DataSet 的数据显示到界面上。 如果数据是一组对象,放到一个 TObjectList 里面,该如何做? 以下操作在 Delphi 10.4 社区版上测试通过。 正文开始: 1. 有一个对象: TMyDev = class private FDevID: string; FDevName: string;

pcplayer的博客 679

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Delphi 利用 LiveBinding 将对象绑定到界面元素

自己定义的一个类,其对象,如何绑定到界面元素? http://docwiki.embarcadero.com/RADStudio/Seattle/en/Tutorial:_Using_TAdapterBindSource_and_the_LiveBindings_Designer 另一篇文章更详细: http://www.malcolmgroves.com/blog/?p=108

pcplayer的博客 2069

【Delphi】使用 TPrototypeBindSource 和 LiveBindings 设计器示例

Delphi数据绑定示例

sensor_WU 博客 1338

Delphi中LiveBindings主从数据绑定实战

数据绑定是现代应用开发中的核心技术,它实现了业务数据与用户界面的自动同步。在Delphi生态中,LiveBindings框架通过声明式绑定机制,大幅简化了数据展示层的开发工作。其核心原理是通过中间适配器建立数据源与控件的关联,支持包括数据转换、格式化等高级功能。TProtoTypeBindSource作为关键组件,特别适合处理具有层级关系的业务数据,如电商系统中的订单-商品、CRM中的客户-联系人等典型场景。通过主从式绑定技术,开发者可以高效实现复杂数据结构的展示与交互,同时保持代码的清晰架构。这种方案在D

weixin_33226548的博客 323

【Delphi】通过 LiveBindings Designer 链接控件示例

Delphi中FMX使用LiveBindings 示例

sensor_WU 博客 831

LiveBindings 绑定对象里面的图片字段,对象要平台中立

问题来源: 假设我有一个数据对象 TnUser = class 里面需要存储图片。 因为 Delphi 的 VCL 和 FMX 对图片的处理,引用的单元不同,为了让这个 TnUser 更单纯,平台中立,它只能存储图片的二进制数据,而不是 TBitmap 或者 TJpeg 这样的对象。 因此,我在这里直接用一个 TMemroyStream 来存储图片的数据。 问题来了,我在 View...

pcplayer的博客 2326

LiveBindings Designer或Wizard,编程创建绑定。 . 使用Fluent LiveBindings简化绑定代码 ...

在Delphi和C++Builder等RAD开发环境中,LiveBindings是一个强大的数据绑定框架,它允许开发者将UI控件与数据源(如对象、数据库字段)动态关联。本文将通过通俗易懂的语言和代码示例,带你探索如何通过编程方式创建绑定,并利用Fluent LiveBindings(流畅接口风格)来简化代码,提升开发效率。:- 复杂绑定(如多个控件联动、条件绑定)时,可视化操作混乱。定义绑定关系:源(Source)是控件的属性,目标(Target)是数据对象的属性。:- 一行代码完成绑定,可读性高。

TJdxCf5W2的博客 235

一步一步学习使用LiveBindings()使用代码创建LiveBindings绑定

TBindingstype // 自定义转换器:将颜色值转换为字符串 TColorToStringConverter = class(TInterfacedObject, IValueConverter) public function Convert(const AValue: TValue): TValue;end;// 颜色源数据 FBindExpression: TBindExpression;

TJdxCf5W2的博客 221
上一篇: FireMonkey ListView 绑定数据显示多个图片
下一篇: 基于 TEdgeBrowser 的富文本编辑器
pcplayer
博客等级 码龄26年 633粉丝 284原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值