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

Delphi FMX开发进阶:DevExpress控件包安装与核心功能实战 在Delphi跨平台开发中,第三方UI控件库是提升开发效率和界面专业性的关键工具。其核心原理在于通过封装复杂功能模块,为开发者提供可复用的高级组件,从而避免重复造轮子。这类控件的技术价值在于能够大幅缩短开发周期,确保功能稳定性和界面一致性,尤其适用于企业级应用和商业化项目。常见的应用场景包括复杂数据网格展示、混合图表可视化、数据导入导出以及移动端硬件交互等。本文聚焦于DevExpress FMX控件包,针对Delphi 12.3环境,详细解析其安装配置流程、核心组件使用,并特别回应了开发者社区中关于deve 阅读详情

问题来源:

假设我有一个数据对象 TnUser = class

里面需要存储图片。

因为 Delphi 的 VCL 和 FMX 对图片的处理,引用的单元不同,为了让这个 TnUser 更单纯,平台中立,它只能存储图片的二进制数据,而不是 TBitmap 或者 TJpeg 这样的对象。

因此,我在这里直接用一个 TMemroyStream 来存储图片的数据。

 

问题来了,我在 ViewModel 里面通过拖放 AdapterBindSource1 和 DataGeneratorAdapter1 并且在 DataGeneratorAdapter1 里面定义对应 TnUser 的字段,图片字段只有 Bitmap 类型。这里面没有 Blob 类型也没有 Stream 类型的字段。

 

在 View 模块也就是界面 Form 上面拖放一个 TImage,一个 BindingsList1,可视化创建 LiveBinding 绑定。设计期可以看到图片。

程序运行时创建 TnUser 的实例,但不给 Photo (TMemoryStream) 赋值。界面上另外两个 string 类型的字段显示出来了,没有图。到这里一切顺利。

 

点击界面按钮,加载一个 JPEG 图片到 FUser 的 Photo 字段,也就是把 Jpeg 文件的数据写入 MemoryStream,刷新绑定,则出来一个类型转换错误。Image 不能对应 Stream。

 

解决办法

如何解决这个问题。当然我首先想到运行期做类型转换。在界面上,双击 BindingsList1,弹出窗口,里面就是可视化创建的连接的对象。选中绑定图片的那个对象,在属性面板里面,切换到事件,可以看到几个事件,其中两个是:OnAssignedValue 和 OnAssigningValue,显然应该在 OnAssigningValue 事件里面写代码转换数据。但因为我还不熟悉 TValue 的操作,一时搞不定转换的数据如何写进去,于是开始想别的办法。

 

以下是别的办法的测试结果:

为了让数据对象 TnUser 平台独立,也就是不要包含 VCL 或者 FMX 的代码,

其中的 Photo 采用 TStream 直接存储数据。

 

如果把这个 Photo 属性直接 LiveBinding 到界面上的 Image,则运行时会说类型转换错误。

那么,这里如何插入我自己写的类型转换代码?

在 LiveBinding 的框架里面,暂时找不到地方插入代码。也搜索不到相关文档。

--- 搞定。2020-2-13 凌晨 3 点。类型转换只需要在连接的事件 OnAssigningValue 里面写,去更改其 TValue 就可以了。

 

因此,我测试了以下方法:

 

1. 给 TnUser 增加一个 Helper 类,为这个类增加一个 Photo2 属性,这个属性是 TBitmap;(本模块是 ViewModel,可以平台相关)

2. 绑定 Image 到 Photo2。但是,运行时,不会触发到 Helper 类的方法。

2.1. 增加一个测试按钮,测试 FUser.Photo2,可以触发 Helper 类的方法,可以获得 Photo2 的属性并显示出来,说明 Helper 类没写错。

也就说明 LiveBinding 在执行绑定的时候不认识 Helper 类。

3. 本模块自己重新引入相关属性,然后绑定到本模块而不是 FUser,运行时出异常;原因是 AdapterBindSource1.OnCreateAdapter 先于本模块的创建。

3.1. 就算把 AdapterBindSource1.AutoActive 设置为 True,它的事件方法依然先于本模块的 Create 被触发调用。

因此,不能采用设置 AutoActive 为 False 然后在运行期设置为 True 来解决这个问题。

 

4. 继承 TnUser,在继承的类里面实现 Photo4 属性,这个属性是 TBitmap 或者 TJpeg,绑定此对象,都能显示。

4.1. 为了跨平台而继承,不是好的解决方法。

 

做完上面那些测试后,回到数据转换,仔细查看 TValue,发现可以写入数据。

正确的解决方法

双击界面上的 BindingsList1 弹出窗口:

选中上面关于图片的连接,看看它的属性面板里面的事件:

 

 

双击 OnAssigningValue 事件,在 IDE 创建的代码框架里面写如下代码:

procedure TForm1.LinkControlToField1AssigningValue(Sender: TObject;
  AssignValueRec: TBindingAssignValueRec; var Value: TValue;
  var Handled: Boolean);
var
  Jpg: TJpegImage;
begin
  if Value.IsObject then
  begin
    if Value.AsObject is TStream then
    begin
      TStream(Value.AsObject).Position := 0;
      Jpg := TJpegImage.Create;
      try
        Jpg.LoadFromStream(TStream(Value.AsObject));

        Value := TValue.From(Jpg);
      finally
        //Jpg.DisposeOf;    这里不能释放 Jpg 对象,否则会 AV。因此,程序在这里需要用一个 TForm1 里面定义的 Jpg 对象反复使用而不是每次都在这里创建新的。
      end;
    end;

  end;

end;

 上述代码搞定,完成了绑定的对象的属性是 TStream 转换为目标需要的 TJpegImage 或者 TBitmap 的问题。这里主要的问题是对 TValue 的操作。

在 VCL 框架下,这里是 TJpegImage 或者是 TBitmap 都能够让界面上绑定的 TImage 正确显示图片。

这样,就实现了数据对象的代码平台中立。而界面 View 肯定是和平台相关的。连 ViewModel 都无需关注平台相关代码。

另:关于如何绑定一个对象,请参考俺的上一篇 Blog。

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. 立即下载

相关推荐

LiveBindings如何绑定一个列表(Demo)

LiveBindings in Delphi XE: TAdapterBindSource and binding to Objects

Delphi Firemonkey 多设备平台中使用 TGrid 实现类似 TDBGrid 的效果

Delphi Firemonkey 多设备平台中使用 TGrid 实现类似 TDBGrid 的效果

tiantang2003的博客 592

Delphi LiveBinding对象及对象序列化为JSON的例子

在Delphi里将对象和界面用LiveBinding方式绑定,用户操作界面改变对象属性值,对象属性值序列化为JSON字符串保存。

delphi MimeType for Restful及delphi mime-type和文件扩展名对照表

delphi MimeType for Restful MimeType是你让编写的应用Restful化编程所必须的。delphi支持哪些MimeType,如何知道这些MimeType与文件扩展名的对应关系,以及它们是文本种类、二进制种类还是未定义的。 一、先上代码 : 已附上面源码下载。由于代码引用了跨平台的文件存取,使用源码注意事项:1、在FormCre...

pulledup的博客 1011

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

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

保姆级教程:在NXPS32144环境下安装EB TRESOS 29.0.0并配置MCAL开发环境

本文提供了一份详细的保姆级教程,指导如何在NXP S32K144环境下安装EB TRESOS 29.0.0并配置MCAL开发环境。内容涵盖从前期资源准备、软件安装步骤、核心的MCAL关联配置,到首次创建AUTOSAR工程并进行模块配置的全流程,旨在帮助汽车电子开发者搭建稳定、可用的底层软件开发地基。

wind6的博客 978

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

介绍Delphi中的数据绑定概念

sensor_WU 博客 2039

高频面试题-项目介绍篇

聊聊如何介绍项目经历。

m0_73359763的博客 1915

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

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

longchanghua_enshi的专栏 1035

VisionMaster 4.2.0安装

按照顺序安装。

XuXing_java的专栏 3994

Xshell 连接 VMware虚拟机操作 截图和使用

vmwareVMware总部位于美国加州帕洛阿尔托(Palo Alto),是全球云基础架构和移动商务解决方案厂商,提供基于VMware的解决方案,企业通过数据中心改造和公有云整合业务,借助企业安全转型维系客户信任,实现任意云端和设备上运行、管理、连接及保护任意应用Xshell(安全终端模拟软件)Xshell [1]是一个强大的安全终端模拟软件,它支持SSH1, SSH2, 以及Microsoft Windows 平台的TELNET 协议。

小 tom的博客 809

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

前言: 本博客前面有文章描述过如何将一个对象的属性和界面元素(比如,Label1)绑定。那篇文章写得有点复杂。这里简化一下操作过程的描述。 Delphi 版本: Delphi 10.4 社区版。 操作方法: 1. 假设有一个类定义: TMyDev = class private FDevID: string; FDevName: string; FIsOnline: Integer; FIsSelected: Integer; public pr

pcplayer的博客 1404

100天精通Python(可视化篇)——第98天:Pyecharts绘制多种炫酷日历图参数说明+代码实战

一、日历图介绍 二、基础配置 1. 配置项类 2. 添加函数 3. 日期标签配置 4. 坐标系配置 三、日历图实战 1. 基础日历图 2. 日历热图

努力让自己发光,对的人才能迎着光而来 2万+

一步一步学习使用LiveBindings() LiveBindings与具有动态呈现的TListView

TBindList数据源配置。

ivTM9evUF的博客 215

2026滑块验证码终极实战:缺口检测算法+人机轨迹模拟,识别率从60%飙升至95%全方案

**摘要:2026年AIGC技术发展导致传统验证码失效,滑块验证码成为主流防护手段。本文深入分析了传统方案识别率低的原因,并提出多级检测融合和行为拟合优化方案。通过图像预处理优化、三级缺口检测引擎(差分图像法、Hu矩轮廓匹配、YOLOv8n模型兜底)将识别率提升至99.2%。同时针对轨迹模拟环节,设计了包含抖动特征、时间随机性和个体差异的行为模型,使通过率从12%提升至87%。该方案解决了传统方法在缺口定位精度和轨迹真实性方面的核心痛点,为应对新一代验证码风控提供了完整的技术框架。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 1914

RagFlow专题三、RagFlow 关键技术(向量数据库、文档分块、Prompt 设计与召回排序优化)

FAISS 是由 Meta(Facebook)开源的高效向量检索库,适用于大规模向量搜索任务。,并了解了如何通过 RagFlow 机制优化信息检索和生成质量。(FAISS、Milvus、ES)用于高效存储和检索语义向量。提高 LLM 生成效果,增强 RagFlow 任务质量。(分块)策略,将文档拆分成更小的片段,提高检索效率。提高检索精准度,避免文本过长导致信息丢失。提升检索结果的相关性,提高生成质量。当多个检索结果被返回时,我们需要一个。在前一篇文章中,我们详细探讨了。在 RagFlow 任务中,

xiaoqi270620903的专栏 3053

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

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

sensor_WU 博客 1558

一文吃透 SAP HANA SDA:把分散数据当作本地数据来用的那把钥匙

摘要:SAP HANA SDA(Smart Data Access)技术详解:150字精要 SAP HANA SDA是一种数据虚拟化技术,允许在不复制数据的情况下访问远端数据源。核心功能包括: 通过Remote Source定义连接配置 创建Virtual Table作为本地代理 支持谓词下推优化查询性能 与SDI技术协同工作扩展数据集成能力 典型应用场景包括: 跨系统联邦查询 冷热数据分层管理 混合云数据整合 远程表复制(RTR)实现近实时数据同步 实施要点: 需关注适配器能力差异 合理运用查询下推优化

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 346

带有 LiveBindings 的 TControlList 创建自适用宽度的列表内容显示

带有 LiveBindings 的 TControlList 创建自适用宽度的列表内容显示

zjg076000的博客 385

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

针对C++和Delphi的LiveBindings一瞥

绑定表达式(Binding expression)并不是新概念,XAML和Flex开发者主要就依靠这个。但除C++/CX(只用于WinRT编程)之外,原生编程语言中通常见不到这种概念。不过为VCL和FireMonkey设计的LiveBindings却是个例外。\u0026#xD;\n我们先来介绍一些背景知识。VCL(Visual Component Library)是Delphi和C++ Buil...

cpongo881 303

InTheHand.Net.Personal+BlueTooth4,蓝牙开发

项目中有蓝牙开发的必备dll,现在网上相关的文档博客不少,有的说的多有的说少,但是却很少有这两个dll,分享一下。

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

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

pcplayer的博客 2709

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

delphi 10.4来了

RAD Studio 10.4新功能 一、Delphi的新功能 1、Delphi Code Insight的重大改进 RAD Studio 10.4是多年来对Delphi代码工具的最大,最大的改进,它使用语言服务器协议(LSP)的Delphi实现提供了Code Insight。LSP是一种在单独的过程中计算代码完成,导航或类似结果的技术。这意味着IDE不会在完成时阻塞,并且Code Insight将提供准确的结果。在处理具有数百万行代码的大型项目时,10.4可大大提高开发人员的工作效率。 2、Del

那是一阵风 1万+

8月28日 XE8移动开发入门(三)XE8在Android应用中调用Java类, 使用LiveBindings(免费培训)

8月28日上午10点,我们开始 介绍RadStudio XE8 移动开发入门培训的第三部分 - XE8在Android应用中调用Java类,以及在应用中使用LiveBindings,本培训为免费Webinar的方式,注册报名点击这里 https://attendee.gotowebinar.com/register/5716882489471390978 。 XE8中提供了Java2OP

英巴卡迪诺中国官方博客 1579

Delphi D10.X VCL和FireMonkey之间的常见差异介绍

尽管FireMonkey控件与VCL控件看上去非常的相似性,但是许多小的差异可能会使熟悉VCL的人不知所措。这里给大家介绍其中一些差异。 VCL与FireMonkey不兼容 警告: FireMonkey与VCL本质上是完全不同的,FireMonkey(FMX)和可视组件库(VCL)不兼容,因此不应在同一模块中一起使用。也就是说,一个模块应该是FireMonkey或VCL之一。不兼容...

tanqth的专栏 2万+

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

DELPHI 10.4版本后,有关Bind的源代码修改了,原来的适用于10.3.3以前的方法不适用了,再来分析下10.4版本以后适用的方法。

舞天涯的专栏 764

FireMonkey TListView 使用 LiveBindings 绑定 TObjectList

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

pcplayer的博客 682
上一篇: LiveBindings 绑定界面元素和存储数据的对象
下一篇: 基于 LiveBindings 的 MVVM 模式的例子代码
pcplayer
博客等级 码龄26年 633粉丝 285原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址