How to support a DBLookupComboBox in TCRDBGrid?

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Steven
Posts: 30
Joined: Fri 06 Dec 2013 19:48

How to support a DBLookupComboBox in TCRDBGrid?

Post by Steven » Wed 15 Jan 2014 23:02

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...

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How to support a DBLookupComboBox in TCRDBGrid?

Post by AlexP » Thu 16 Jan 2014 13:56

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.

Steven
Posts: 30
Joined: Fri 06 Dec 2013 19:48

Re: How to support a DBLookupComboBox in TCRDBGrid?

Post by Steven » Thu 16 Jan 2014 19:40

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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How to support a DBLookupComboBox in TCRDBGrid?

Post by AlexP » Fri 17 Jan 2014 12:36

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)

Steven
Posts: 30
Joined: Fri 06 Dec 2013 19:48

Re: How to support a DBLookupComboBox in TCRDBGrid?

Post by Steven » Fri 17 Jan 2014 15:45

Not familiar with LookUp fields.
Any suggestions on where I could find out more information?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How to support a DBLookupComboBox in TCRDBGrid?

Post by AlexP » Fri 17 Jan 2014 16:14

Hello,

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

Steven
Posts: 30
Joined: Fri 06 Dec 2013 19:48

Re: How to support a DBLookupComboBox in TCRDBGrid?

Post by Steven » Fri 17 Jan 2014 17:38

Thank you, I will check it out!

Post Reply