当前位置:网站首页>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.
边栏推荐
- 2021 CCPC Harbin I. power and zero (binary + thinking)
- 每日一题-LeetCode1200-最小绝对差-数组-排序
- redis03——Redis的网络配置与心跳机制
- Jerry's ad series MIDI function description [chapter]
- 华为ensp模拟器实现通信安全(交换机)
- 【微服务|SCG】Predicate的使用
- [buuctf.reverse] 151_[FlareOn6]DnsChess
- TCP三次握手,四次挥手,你真的了解吗?
- Embedded TC test case
- For MySQL= No data equal to null can be found. Solution
猜你喜欢
Three or two things about the actual combat of OMS system
[weekly translation go] how to code in go series articles are online!!
Maya lamp modeling
MP3是如何诞生的?
NetWare r7000 Merlin system virtual memory creation failed, prompting that the USB disk reading and writing speed does not meet the requirements. Solution, is it necessary to create virtual memory??
IIC (STM32)
Huawei ENSP simulator configures ACL access control list
At the right time, the Guangzhou station of the city chain science and Technology Strategy Summit was successfully held
[C language] deep understanding of symbols
Compréhension approfondie du symbole [langue C]
随机推荐
2021 CCPC 哈尔滨 B. Magical Subsequence(思维题)
Jerry's ad series MIDI function description [chapter]
Test case (TC)
【C语言】符号的深度理解
Can be displayed in CAD but not displayed in print
华为ensp模拟器 给路由器配置DHCP
Monitor the shuttle return button
杰理之AD 系列 MIDI 功能说明【篇】
FastDfs的快速入门,三分钟带你上传下载文件到云服务器
【公开课预告】:视频质量评价基础与实践
torch. Tensor and torch The difference between tensor
shp数据制作3DTiles白膜
解析steam教育中蕴含的众创空间
Stealing others' vulnerability reports and selling them into sidelines, and the vulnerability reward platform gives rise to "insiders"
__ init__ () missing 2 required positive arguments
2021 CCPC 哈尔滨 I. Power and Zero(二进制 + 思维)
NetWare r7000 Merlin system virtual memory creation failed, prompting that the USB disk reading and writing speed does not meet the requirements. Solution, is it necessary to create virtual memory??
Gobang go to work fishing tools can be LAN / man-machine
杰理之AD 系列 MIDI 功能说明【篇】
Analysis of maker education technology in the Internet Era