再谈 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 博客 1557

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

舞天涯的专栏 810

U8+ 新建账套

一、登录 账套主管:demo 对账套有修改权限,有账套库权限 系统管理员:admin 其他所有权限 二、新建账套 admin登录–>点击系统管理–>账套–>建立 选择了参照已有账套结转期初:就是上一个的期末数据作为这一次新表的期初数据 启用会计期一旦选择更改不了。 ...

茶茶很困i 3700

别再只会插卡了!用示波器实测SIM卡上电时序与通信波形(附故障排查)

本文深入解析了SIM卡通信的电气信号与时序规则,通过示波器实测波形揭示SIM卡上电时序与通信协议的关键细节。从VCC、CLK、RST、DATA四路信号的协同工作,到ATR(Answer to Reset)的解析,再到常见故障的波形诊断与排查方法,为硬件工程师提供了实用的调试指南。文章还分享了高级调试技巧与现代化工具链搭建建议,帮助提升物联网设备SIM卡通信的可靠性与效率。

weixin_42567279的博客 338

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

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

longchanghua_enshi的专栏 1034

IDEA中Maven工具栏与命令执行全攻略:高效开发必备技巧

IntelliJ IDEA 作为强大的 Java 开发工具,其 Maven 功能独具优势。Maven 工具栏位于工作区右侧,图标功能丰富,涵盖项目导入、源码处理、依赖操作等。执行 Maven 命令有多种途径,Run Anything 窗口可输入或选目标执行,上下文菜单能右键运行目标,还可创建运行配置,指定命令参数后运行,为开发者高效管理 Maven 项目、便捷执行命令提供有力支持。

2301_82300081的博客 2039

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

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

pcplayer的博客 2708

手把手教你搞定JBI投稿:从Statement of Significance到Declaration Statement的保姆级避坑指南

本文提供了一份详细的JBI投稿指南,重点解析Statement of Significance和Declaration of Interests的撰写技巧,帮助研究者避开常见格式陷阱。通过实战案例和检查清单,确保投稿符合JBI的学术严谨性和临床转化价值要求,提升稿件通过率。

weixin_29278805的博客 637

ROS2+MoveIt2+Gazebo仿真实战:从零搭建六轴机械臂控制环境(避坑指南)

本文详细介绍了如何从零搭建ROS2+MoveIt2+Gazebo六轴机械臂控制环境,涵盖环境准备、URDF建模、MoveIt2配置、Gazebo联调等关键步骤,并提供了实用的避坑指南和调试技巧,帮助开发者高效完成机械臂仿真与控制任务。

weixin_29045585的博客 445

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

介绍Delphi中的数据绑定概念

sensor_WU 博客 2037

ADC INL&DNL测试方法和实例

本文介绍了一种可操作的ADC INL和DNL的测试方法--直方图法(也称码密度法)。并实际使用该方法测试了两款芯片的ADC INL和DNL

APTCHIP的博客 1万+

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

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

weixin_30219613的博客 223

从零开始的机械臂yolov5抓取gazebo仿真(一)

本文介绍了如何将机械臂模型导出为URDF

qq_48427527的博客 1万+

基于STM32L4XX、HAL库的MP2672GD-0000-Z充电芯片驱动程序设计

CHG_STAT_GPIO_Port, CHG_STAT_Pin, // 这些宏应由 CubeMX 生成在 main.h。

zhusl6688的博客 499

LiveBindings对象绑定:TAdapterBindSource实战

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

weixin_28746457的博客 304

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

Delphi LiveBindings技术:对象绑定实战与优化

数据绑定是现代软件开发中的关键技术,通过建立数据源与UI元素的自动同步机制,可大幅提升开发效率。LiveBindings作为Delphi平台的核心绑定框架,采用声明式编程范式实现双向数据流,其独特价值在于支持复杂对象图的路径解析和类型自动转换。在工程实践中,结合TAdapterBindSource组件可减少40%以上的胶水代码,特别适用于电商系统等需要处理多层嵌套对象的场景。通过可视化设计器和运行时调试工具,开发者能快速实现从简单表单到虚拟化列表的各种绑定需求,同时利用INotifyCollectionCh

weixin_33417488的博客 308

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

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

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

weixin_55010563的博客 1078

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

FireMonkey TListView 使用 LiveBindings 绑定 TObjectList

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

pcplayer的博客 681

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

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

pcplayer的博客 2071

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

Delphi数据绑定示例

sensor_WU 博客 1342

Delphi中LiveBindings主从数据绑定实战

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

weixin_33226548的博客 323

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

Delphi中FMX使用LiveBindings 示例

sensor_WU 博客 833

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

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

pcplayer的博客 2326

Delphi LiveBindings实现主从数据绑定实战

数据绑定是现代应用开发中连接UI与业务数据的关键技术,其核心原理是通过声明式配置建立数据源与可视化控件的自动同步机制。在Delphi开发体系中,LiveBindings组件通过属性映射和变更通知机制,实现了零代码的数据绑定解决方案,特别适合需要快速迭代的业务系统开发。相比传统的数据感知控件方式,该技术提供了更灵活的布局可能性和更精细的控制粒度,能有效减少约40%的数据处理代码量。在数据库应用场景中,通过Master-Detail(主从关系)绑定模式,可以轻松实现分类商品、订单明细等典型业务关系的可视化呈现。

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

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值