Delphi XE2 新功能 liveBinding 介绍

delphi增删改查小模块 delphi增删改查小模块(含数据库) 2种模式:用数据感知控件和普通控件代码实现 立即下载

新版本的Delphi XE2 使用FireMonkey框架,它不同于VCL,以往的数据感知控件不能放在它上面,所以XE2提供了LiveBinding功能作为替代方案。另外它也是通用的基础设施,同样可用于传统的VCL.这里用一个极其简化的例子说明它的意图,在窗体上放一个edit和一个label,找到label的LiveBings属性,选New LiveBinding...,再选择TBindExpressing.

然后设置属性如下图所示:

这样就把 edit 的 text 属性和 label 的 caption 属性绑定起来了,不用写任何代码。运行后,会看到 label 的内容就是 edit 的 text 值,但是在 edit 中输入内容,label 却没有跟着变化,如果要重新获得 edit 的值,可以用代码:

Self.BindExpressionLabel11.Evaluate;//这个BindExpressionLabel11,就是刚才点 New LiveBinding... 时新建的对象。

BindExpressionLabel11 的 SourceComponent 属性,用于指定数据来源于哪里(哪个对象)。SourceExpression 属性,是一个表达式,示例中只是简单的写了 text,这个 text 就是 SourceComponent 的属性(也就是指 TEdit 的属性)。
还可以写这样的表达式:

   Text+'aaa'

   name+text

但是却不能写 trim(text) 这样的表达式,不过我们可以用它的 OnAssignValue 事件来实现这个功能,这个事件在 Evaluate 时触发,表达式所计算出来的值被放在事件的 var Value: TValue 参数里,它是个var 的,所以可以修改它的值:

procedure TForm1.BindExpressionLabel1AssignValue(  

   AssignValueRec: TBindingAssignValueRec; var Value: TValue;  

   var Handled: Boolean);  

begin 

  value:=trim(value.AsString);  

end;

LiveBingings 也可以感知数据集,但是要在 FireMonkey 2D Application 环境下,在窗体上放一个 label,同样再找到 LiveBindings 属性,会发现它多了一项 Link to DB Field... 

选择它,出现下面的图,这个界面里的树,描述了当前窗体上放置的数据集,和它的字段,设置好后,它看起来就象是个 TRzDbLabel 了,实时显示字段值,不需要象上面的例子那样写Evaluate()

 

转自http://www.cnblogs.com/hieroly/archive/2012/02/14/2350443.html

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

相关推荐

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

LiveBindings in Delphi XE: TAdapterBindSource and binding to Objects

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

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

tanqth的专栏 2万+

Delphi7以后至XE2所有的变化

Reasons to Migrate to Delphi XE2 What you might have missed since Delphi 7 126页,英文。

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

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

舞天涯的专栏 763

LLVM实战:如何用Clang+LLVM打造你的第一个C++编译器(附完整配置步骤)

本文详细介绍了如何使用Clang+LLVM构建C++编译器的完整配置步骤,从环境准备到编译流程剖析,再到调试与优化技巧。通过实战指南,帮助开发者深入理解LLVM编译器框架的工作原理,并掌握交叉编译与性能分析等高级功能。

sprite的博客 758

解决用加速器以后,电脑无法连接网络的问题

相信很多朋友也遇到过,用加速器以后,电脑网络直接断了,或者访问外网时打不开的情况解决办法是。

qq_46368050的博客 1万+

Delphi Live Bindings 初探

Delphi Live Bindings 初探 Live Bindings,顾名思义,动态绑定。 1、绑定前: 2、点击数据源: 3、绑定连线:点击 蓝色区域, 按住 鼠标左键,一直移动到绿色区域,然后松掉鼠标左键。 系统就完成了系统绑定: 然后,Label1(数据的接受者),就会随 Edit1(数据的提供者)的数据变化而变化。 Edit1...

dengshisha4819的博客 350

3D Gaussian Splatting:用于实时的辐射场渲染

3D Gaussian Splatting:用于实时的辐射场渲染 3d gaussian splatting for real-time radiance field rendering

m0_51976564的博客 1万+

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

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

舞天涯的专栏 810

WSL2双显卡配置实战:避开Tesla与TCC模式的那些坑

本文针对WSL2环境下无法识别Tesla计算卡的问题进行深度解析。核心原因在于WSL2目前仅支持WDDM模式的显卡,而Tesla系列及运行在TCC模式下的显卡因采用纯计算架构而无法兼容。文章提供了详细的排查步骤,并给出了包括调整显卡用途、使用虚拟机或物理机在内的多种实用解决方案,帮助开发者避开配置陷阱。

weixin_29289821的博客 553

在QTableWidget中添加支持多选的QComboBox并显示

定义自定义表格项,主要用于显示复选框自定义的多选ComboBox类自定义委托类,用于表格中的多选ComboBox代码展示如下。

YUyang0304的博客 2794

Delphi XE2 新技术说明

看看XE 2中到底有什么新东西。 1. VCL Style 如果你对Web编程很熟,VCL Style就是delphi版的css,想像一下只要换一个style,所有的按钮菜单表格都换了新的颜色和风格,十分酷。XE2中自带了预定义的几种Style,用户可以添加新的并且和其他人分享。 2. 64Bit Support 大部分人可能用不到,可对少数用大内存的程序应该就非常有用了。 3. Fi...

java开发指南博客 【转载】 103

开坑!双向逆变电源实操系列--第一节PFC

文章摘要 本文介绍了PFC(功率因数校正)的基本概念及其重要性。PFC电路通过储能和功率因数校正两大功能,解决交流电小电压大电流的问题,并减少无功电流损耗。文章对比分析了无源PFC(电感串联式、填谷式、LC谐振式)和有源PFC(升压型、交错并联、图腾柱式)的拓扑结构及适用场景。针对2400W双相逆变电源设计,作者选择图腾柱PFC拓扑,详细阐述了设计思路,包括电气参数计算、性能指标设定、技术重点及风险预判。文章还提供了主电路参数定制计算方法,如BOOST电感值的推导过程,为电源工程师提供实用参考。

lyzh971103的博客 2573

使用LiveBinding Delphi XE2

【本文转自Blog of NeuglsWorkStudio】 为了方便解释如何在程序中使用LiveBinding, 请建立一个控制台程序。 首先 你需要在Uses子句中添加以下几个单元: Uses System.Bindings.Expression, System.Bindings.Helper; 要了解更多的信息,请查看相关的API说明文档: Syst...

dieba6990的博客 202

PyCharm配置SSH和SFTP远程连接服务器

关于这篇博文,主要因为公司企业都是通过本地测试,同步到服务器进行跑动,舍友看着同事丝滑的操作,让我做个教程。本着钻研的精神,写下了这篇博客记录 关于pycharm这个软件,只有专业版才有远程连接的这个配置,社区版没有(同事一再强调要专业版,学生认证还可申请免费) 关于SSH和SFTP都是一种协议 具体知识点补充可看我这篇文章: 【计算机网络】常见面试题集锦(全) SSH:提供安全通道进行远程登录 SFTP协议可以远程文件传输获取等,数据的安全传输主要由SSH连接提供

码农研究僧的博客 5545

Python爬虫实战:抓取统计数据并生成年度对比图表详解

国家统计局网站(静态HTML页面Excel文件JSON接口(部分新版API)我们将重点演示从统计公报页面抓取数据,结合解析Excel文件,实现多种数据格式爬取处理。本文从零开始搭建了一个爬取国家统计数据并制作年度对比图表的完整流程。读者可以根据实际需求调整爬取目标,丰富数据分析维度,甚至结合机器学习模型预测未来趋势。欢迎你在评论区留言分享你的爬虫实践,或提出改进建议!

2201_76125261的博客 1006

Delphi XE2 新技术说明 (What's new in Delphi XE2)

今天参加了Delphi XE2的产品发布会,趁热打铁,整理下笔记,看看XE 2中到底有什么新东西。 1. VCL Style 如果你对Web编程很熟,VCL Style就是delphi版的css,想像一下只要换一个style,所有的按钮菜单表格都换了新的颜色和风格,十分酷。X

技术只是工具,人生才是目标 1万+

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Delphi XE 10 跨平台三层数据库应用教程

DelphiXE10跨平台三层数据库应用教程 Delphi XE开始越来越庞大,比经典的Delphi7难用,但依然是目前所有跨平台开发工具中开发效率最高、最容易上手的,其快速设计RAD理念是无与伦比的符合人性(什么?是懒惰)。 目前网上XE10类似教程很少,而且学习途中遇到一些问题就难以继续了,经本菜鸟千辛万苦的求索,特推出Delphi XE 10系列教程。 三层数据库应用是目...

wxzmbf的专栏 4457

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

DELPHI XE2马上推出

DELPHI XE2马上推出 将是一场技术革命 DELPHI XE2 马上要推出了,那将是一场技术革命!支持64位开发,移动平台开发,web开发等等...今天参加了Delphi XE2的产品发布会,趁热打铁,整理下笔记,看看XE 2中到底有什么新东西。   1. VCL Style   如果你对Web编程很熟,VCL Style就是delphi版的css,想像一下只要换一个styl...

v5qqcom 221

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

伟大的DELPHI XE2 马上推出 将是一场技术革命(转)

伟大的DELPHI XE2 马上要推出了,那将是一场技术革命!支持64位开发,移动平台开发,web开发等等...今天参加了Delphi XE2的产品发布会,趁热打铁,整理下笔记,看看XE 2中到底有什么新东西。1. VCL Style如果你对Web编程很熟,VCL Style就是delphi版的css,想像一下只要换一个style,所有的按钮菜单表格都换了新的颜色和风格,十分酷。XE2中自带了预定...

weixin_30337251的博客 75

Delphi XE2 新功能:LiveBindings --- 把对象之间的属性绑定起来

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33696106的博客 136

delphi xe5 调用 android 浏览器,DELPHI XE5开发WEB服务器及安卓手机客户端

2、选择stand-alone vcl application 3、这里使用 默认端口8080 4、选择创建接口 5、给服务起个名字 6、点ok后保存工程,保存为目录如下: 7、至此为止,什么代码都不写,点击运行,我们看到 8、启动并点击 open browser按钮在浏览器里看到 一个web服务就创建完成了。接下来创建一个返回数据集的过程,用webservices发布,供手机端调用。这里我...

weixin_33882158的博客 533

DELPHI XE5开发WEB服务器及安卓手机客户端

Xe5开发web服务端和手机客户端 时间:2013-9-18 17:09:45 点击: 6456 Delphi xe5作为最新开发利器,就类似如当年的DELPHI,功能强大,快发速度快,把VS2012远远甩在后面。下面以一个小例作为您开启新的历程:  建立一个webservices  stand-alone vcl application 作为手机访问的服务端 1、new-

4790

LiveBinding应用 dataBind 数据绑定

http://blog.csdn.net/embarcaderochina/article/details/50352193 firemonkey grid/listview dataBind,数据绑定 XE在FireMonkey平台引入了LiveBinding技术,展示数据很是方便 FireMonkey下在Android、Windows可以使用,VCL也可以使用Binding技术。使用St...

weixin_34258838的博客 345
上一篇: Delphi 框架Frames的使用
下一篇: 解决Delphi XE(2010,2009)里的UTF8乱码问题
蓝色的天堂
博客等级 码龄16年 25粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值