当前位置:网站首页>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.
边栏推荐
- 迈动互联中标北京人寿保险
- OMS系统实战的三两事
- Monitor the shuttle return button
- 杰理之AD 系列 MIDI 功能说明【篇】
- At the right time, the Guangzhou station of the city chain science and Technology Strategy Summit was successfully held
- 吐槽 B 站收费,是怪它没钱么?
- Configuration of DNS server of Huawei ENSP simulator
- Huawei ENSP simulator enables devices of multiple routers to access each other
- 应用实践 | 蜀海供应链基于 Apache Doris 的数据中台建设
- 如何使用ConcurrentLinkedQueue做一个缓存队列
猜你喜欢
随机推荐
Kubedm initialization error: [error cri]: container runtime is not running
maya灯建模
数十亿公民信息遭泄漏!公有云上的数据安全还有“救”吗?
类方法和类变量的使用
Redis pipeline
For MySQL= No data equal to null can be found. Solution
torch.tensor和torch.Tensor的区别
Redis bloom filter
Solution of 5g unstable 5g signal often dropped in NetWare r7000 Merlin system
Arcgis 10.2.2 | arcgis license server无法启动的解决办法
2021 CCPC 哈尔滨 B. Magical Subsequence(思维题)
Flutter WebView示例
Analysis of maker education technology in the Internet Era
The video sound of station B is very low - solution
c语言函数形参自增自减情况分析
Huawei ENSP simulator layer 3 switch
华为ensp模拟器 DNS服务器的配置
minidom 模块写入和解析 XML
Liu Jincheng won the 2022 China e-commerce industry innovation Figure Award
网件r7000梅林系统5g不稳定 5g信号经常掉线解决方法