当前位置:网站首页>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.
边栏推荐
猜你喜欢

杰理之增加进关机前把触摸模块关闭流程【篇】

Maidong Internet won the bid of Beijing life insurance

Foxit pdf editor v10.1.8 green version

Day24: file system

每日一题-LeetCode556-下一个更大元素III-字符串-双指针-next_permutation

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

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

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

LambdaQueryWrapper用法

华为ensp模拟器实现通信安全(交换机)
随机推荐
Jerry's ad series MIDI function description [chapter]
【optimtool.unconstrain】无约束优化工具箱
minidom 模塊寫入和解析 XML
Jerry's ad series MIDI function description [chapter]
Kubeadm初始化报错:[ERROR CRI]: container runtime is not running
2021 CCPC 哈尔滨 I. Power and Zero(二进制 + 思维)
Redis:Redis配置文件相关配置、Redis的持久化
Stealing others' vulnerability reports and selling them into sidelines, and the vulnerability reward platform gives rise to "insiders"
华为ensp模拟器实现通信安全(交换机)
2021 CCPC Harbin B. magical subsequence (thinking question)
Gobang go to work fishing tools can be LAN / man-machine
Nmap scan
Analysis of maker education technology in the Internet Era
【C语言】符号的深度理解
LambdaQueryWrapper用法
y56.第三章 Kubernetes从入门到精通 -- 业务镜像版本升级及回滚(二九)
Procurement in software development
Jerry's ad series MIDI function description [chapter]
Learning breakout 3 - about energy
杰理之AD 系列 MIDI 功能说明【篇】