当前位置:网站首页>Drop down selection of Ehlib database records
Drop down selection of Ehlib database records
2022-07-04 21:33:00 【pcplayer】
The goal is :
Select from the drop-down list , Know which record the user has selected in the database . Just to know , Instead of inputting .
There is a table , There are many records . Provide an interface for users to select a record from the table . The program obtains the user's selection results .
The easiest way , Give me a DBGrid, The user moves the cursor to the selected record ( By scrolling and clicking DBGrid A record in it ), Then the program reads its corresponding DataSet.
DBGrid Too much space . It's better to have a similar Edit Things that are , Then there is a drop-down button , Click this button , Come down and come out a box , There are multiple records in the box for users to choose . Select the result to be displayed in this Edit Inside .
use EhLib Control for , It is easier to achieve such an effect .
Method
There are two kinds of controls that can be used :
A. TDBLookupComboboxEh;
B. TDBEditEh;
hypothesis : The tables used for user selection are 2 A field :V_ID and V_Name;
The value of the data sensitive control of the interface , Not a direct read control , It is bound by the read control DataSet. therefore , In order to read the results of user selection interface controls , Must put one DataSet ad locum . Here I put one ClientDataSet1, And create... For it 3 A field :V_ID; V_Name; VName; among VName It's a Lookup Field ;
A. use TDBLookupComboboxEh
DBLookupComboboxEh1 It has a drop-down button , This drop-down button will pull down a box . Multiple fields can be displayed in this box . About the setting of this box , Is its attribute :DropDownBox;
however , This drop-down selection box , Not as good as DropDownForm To use . because DropDownForm I can put one in it DGBridEh, More powerful , For example, one more filter input field .
To make DBLookupComboboxEh1 The drop-down triangle button on the right , After clicking, there is a DropDownForm, Need to find its attribute :EditButton, Expand this property on the property panel , There is DropDownFormParams attribute , Expand it , You can set its DropDownForm 了 .
After setting up , Runtime , Click its triangle drop-down button , What comes out is not its own DropDownBox It's this DropDownForm 了 .
DBLookupComboboxEh1 Of DataSet Several properties of :
The goal is : Select from the drop-down list , Know which record the user has selected in the database . Just to know , Instead of inputting .
1. DataSource attribute , Corresponding DataSource And its DataSet, It's a local ClientDataSet, It is only used to carry the results of user selection . It has three fields :V_ID; V_Name; VName; among VName It's a Lookup Field ;
2. DataField attribute , Corresponding V_ID Field ;
3. ListSource attribute , For applications that allow users to select multiple records DataSet;
4. ListField attribute , It's for DropDownBox The fields displayed inside . Of course , If it is specially set DropDownBox Some attribute settings under attributes , You can add several fields . That is, you can see the display of several more fields after dropping down .
5. If the DropDownForm, Maybe the above ListSource The setting of ?
About EhLib Of DropDownForm, I won't explain it in detail here .EhLib Self contained Demo There is its example code .
I also wrote an article , Talk about DropDownForm Usage of , The address is :
https://blog.csdn.net/pcplayer/article/details/113873604
B. use DBEditEh:
Use DBEditEh1 You can also pull down DropDownForm Let the user choose the effect of a record , Doing this :
1. The most important point , This DBEditEh1 Of DataField To point to VName This Lookup Field , instead of V_Name This field ; Otherwise, it does not display ;
2. DBEditEh1 Of DataSource It also implements the above local ClientDataSet;
3. In the property panel , Find it. EditButtons term , Double clicking will pop up a small window , Used to add buttons . Right click in the small window and select Add after , A button will come out . Select the newly added button in the small window , There are DropDownFormParams term , Expand this , You can set a DropDownForm;
Complete the above settings , You can go to DBEditEh1 Inside , Also see a drop-down button , Pull down and pop up DropDownForm.
边栏推荐
- 应用实践 | 蜀海供应链基于 Apache Doris 的数据中台建设
- 杰理之AD 系列 MIDI 功能说明【篇】
- Configuration of DNS server of Huawei ENSP simulator
- EhLib 数据库记录的下拉选择
- 刘锦程荣获2022年度中国电商行业创新人物奖
- 华为ensp模拟器 实现多个路由器的设备可以相互访问
- [buuctf.reverse] 151_ [FlareOn6]DnsChess
- Golang面试整理 三 简历如何书写
- Jerry's ad series MIDI function description [chapter]
- 解读创客教育中的各类智能化组织发展
猜你喜欢

Huawei ENSP simulator enables devices of multiple routers to access each other

【活动早知道】LiveVideoStack近期活动一览

【optimtool.unconstrain】无约束优化工具箱

UTF encoding and character set in golang

如何使用ConcurrentLinkedQueue做一个缓存队列

WGCNA分析基本教程总结
![Jerry added the process of turning off the touch module before turning it off [chapter]](/img/28/5e4eb39243a0c973d0b90f76571f9b.png)
Jerry added the process of turning off the touch module before turning it off [chapter]

每日一题-LeetCode1200-最小绝对差-数组-排序

Y56. Chapter III kubernetes from entry to proficiency -- business image version upgrade and rollback (29)

【微信小程序】协同工作与发布
随机推荐
改善机器视觉系统的方法
Kubedm initialization error: [error cri]: container runtime is not running
【LeetCode】17、电话号码的字母组合
2021 CCPC Harbin B. magical subsequence (thinking question)
WGCNA analysis basic tutorial summary
Why does invariant mode improve performance
For MySQL= No data equal to null can be found. Solution
旋变串判断
解读创客教育中的各类智能化组织发展
Redis bloom filter
c语言函数形参自增自减情况分析
__init__() missing 2 required positional arguments 不易查明的继承错误
How was MP3 born?
Maya lamp modeling
minidom 模塊寫入和解析 XML
【公开课预告】:视频质量评价基础与实践
杰理之AD 系列 MIDI 功能说明【篇】
Configuration of DNS server of Huawei ENSP simulator
Jerry added the process of turning off the touch module before turning it off [chapter]
Flutter TextField示例