Page 1 of 1

How to support a DBLookupComboBox in TCRDBGrid?

Posted: Wed 15 Jan 2014 23:02
by Steven
How to support a DBLookupComboBox in TCRDBGrid?

I am using Delphi Xe2 with a TCRDBGrid and I am trying to have it contain a drop down list (DBLookupComboBox).

Background
I've got a Product table that relies heavily on a number of related lookup tables (country, state/province, units (lbs,oz,gr,kg), product_type, etc.) and my customer wants to be able to edit the table within the grid.

I was hoping the TCRDBGrid might have some built in support for something like this (embedding a tDBLookupComboBox), but if it does I didn't see it.

Attempted Resolution
So I tried to implement a solution documented in AboutDelphi.com's article Drop down list (DBLookupComboBox) inside a DBGrid
http://delphi.about.com/od/usedbvcl/l/aa101403b.htm

While it works the problem is that once the DBLookupComboBox is visible if you scroll the field synced with the combobox off the visible area for the grid - the combobox still stays visible and is parked on the edge of the grid.

Is there a way to determine when a DBGrid cell is onscreen or offscreen?
If so I could close the DBLookupComboBox via code when the cell in question is not showing.

Also wondering if there is an easier way to do this embedded DBLookupComboBox thing.

Do you have any suggestions?

Thanks...

Re: How to support a DBLookupComboBox in TCRDBGrid?

Posted: Thu 16 Jan 2014 13:56
by AlexP
Hello,

We are not involved in development of visual components, and don't support CRDBGrid anymore - it is free and supplied as sources (we just fix bugs). If you found problems with the code provided in the article, please contact the author of the article.

Re: How to support a DBLookupComboBox in TCRDBGrid?

Posted: Thu 16 Jan 2014 19:40
by Steven
This is not a bug in TCRDBGrid.
Was really just trying to find a way to determine when a DBGrid cell is onscreen or offscreen.

Re: How to support a DBLookupComboBox in TCRDBGrid?

Posted: Fri 17 Jan 2014 12:36
by AlexP
Hello,

Instead of embedding DBLookupComboBox to DBGrid, LookUp fields may help, that can be configured similarly to the sample you have provided.

P.S. Concerning cell position detecting in DBGrid, you'd better contact the developer (Embarcadero)

Re: How to support a DBLookupComboBox in TCRDBGrid?

Posted: Fri 17 Jan 2014 15:45
by Steven
Not familiar with LookUp fields.
Any suggestions on where I could find out more information?

Re: How to support a DBLookupComboBox in TCRDBGrid?

Posted: Fri 17 Jan 2014 16:14
by AlexP
Hello,

You can find the LookUp fields description on the Embarcadero website: http://docwiki.embarcadero.com/RADStudi ... okup_Field

Re: How to support a DBLookupComboBox in TCRDBGrid?

Posted: Fri 17 Jan 2014 17:38
by Steven
Thank you, I will check it out!