Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DBLookupComboBox and DBGrid (Delphi 3)

Posted on 1999-01-21
17
Medium Priority
?
2,300 Views
Last Modified: 2008-02-20
Hello !

How to use a DBLookupComboBox in a DBGrid ?
I want to select the data of a table in a combobox-cell.
Can you give me an example ?

Thanx.
0
Comment
Question by:nk51
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 3
  • +2
17 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1362680
Hi nk51,

read this article : http://www.gnomehome.demon.nl/uddf/pages/dbgrid.htm#dbgrid1

regards, Zif.
0
 

Author Comment

by:nk51
ID: 1362681
The answer you give is for a DBLookUpCombo and not for a DBLookUpCombobox...
I try to use a DBLookUpComboBox with the proposed code but with no succes.


0
 
LVL 1

Expert Comment

by:velev
ID: 1362682
create lookup field in your DataSet (tquery or ttable)
and add a cloumn in your DBGrid that is attached to this field

but do not forget working with lookups is slow operation slow
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:nk51
ID: 1362683
Can you explain the steps to do this with more details please ?

0
 
LVL 1

Expert Comment

by:velev
ID: 1362684
dblClick on your main dataset (tquery or tTable)
a window will popup
click btn add new field, another window will apear
adjust properties of the new field - make field lookup and adjust its properties( they are like this when adjusting properties for DBLookupCombo...)


dblClick on your DBGrid
add cloumn in the popuped window and set the field property of this column to above created field


0
 

Author Comment

by:nk51
ID: 1362685
I don't understand...Sorry. What about the DBLookupCombobox ?
0
 
LVL 1

Expert Comment

by:velev
ID: 1362686
the above procedure will help
DBGrid will use as InplaceEditor for such colomns (linked to lookup fields) component that has similar behavior to that of
DBLookup...



0
 
LVL 1

Expert Comment

by:adeng
ID: 1362687
Delphi DBGrid has its own DBLookupComboBox included, you don't have to make your own ! but if you do !?!

And about Zif proposed answer about DBLookupComboBox in http://www.gnomehome.demon.nl/uddf/pages/dbgrid.htm#dbgrid1 just rename your DBLookUpComboBox component name to DBLookUpCombo1 !

Regard, Adeng.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1362688
nk51,

 here is another article if you haven't figured it out yet, with the other one.

Regards, Zif.
0
 

Author Comment

by:nk51
ID: 1362689
To velev : which above procedure ? I don't have a good english and perhaps I don't understand what you write but I don't understand your answer...

Adeng said that "Delphi DBGrid has its own DBLookupComboBox included, you don't have to make your own !".
Is it true ? Because It's better fo me.
How to use the own DBLookupComboBox of e DBGrid?
Thanx.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1362690
hehe, forgot the article :

http://www.delumpa.com/tips/comps/comps10.htm

topic from Delumpa (writer of article)

Note: Some of you old hats at Delphi might immediately exclaim, "What's the use of this article? In Delphi 3, we have the capability of specifying a cell in a DBGrid to be a drop-down edit." Well, that's the thing, isn't it? You have to fill in the values of the Items property yourself. What I'm suggesting here is adding a TDBLookupComboBox that will enable you to look up information from another data source. This isn't available in ANY version of Delphi.
By the way, this isn't my original idea, and in fact, the technique has been around since Delphi 1. But it's valid and applicable to Delphi 3.


Regards, Zif.
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 400 total points
ID: 1362691
Hi nk51,

how to do,

the mastertable should contain the two fields of your lookuptable

example
mastertable

. Fields ... ,ALookupKeyField,ALookupResultField

LookUpTable

ALookupKeyField, ALookupResultField  (ALookupKeyField should be primary index)

drop the two tables, a datasource, a dbgrid on a form
set the propertys of these components, so that the grid shows your mastertable and both tables are active

deactivate your mastertable (property active = False)
doubleClick of the tablecompenentsymbol on your from, an empty columeditor pops up
rightclick on this editor, select insert fields om the popupmenu
the columeditor is now filled with the fields of your mastertable, select the ALookupResultField

set in the objectinspector now following propertys

KeyField = ALookupKeyField from your mastertable
LookUpCache = True
LookUpDataSet = YourLookUpTable
LookUpKeyFields = ALookupKeyField from your LookUpTabletable
LookUpResultField = ALookupResultField from your LookUpTabletable
FieldKind = ftLookUp

set your mastertable active
run your application

you will see that in your grid if you edit your ALookupResultField a dropdownbutton apears
on dropping down you see the entrys of your lookuptable

good luck on the try

meikl ;-)
0
 

Author Comment

by:nk51
ID: 1362692
Just what I needed.
The latest ZifNab's comment about the article : http://www.delumpa.com/tips/comps/comps10.htm 
said the same thing.
Thanx.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1362693
Hi nk51,

i wondered about this fast evaluation.

zif,

sorry, i haven't read this article, i've figured out byself.

meikl
0
 

Author Comment

by:nk51
ID: 1362694
Your answer is the same as ZifNab.
And ZifNab answered the Monday, January 25 1999 - 10:56AM PST
and we are Friday, January 29 1999.
So I had all the time to try Delumpa's advices.  


0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1362695
... :-) I didn't answer.... I gave a comment .... ;-))

kretzschmar, no problem! Keep smiling!
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1362696
:-) i smile ;-)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question