Board index » delphi » Incremental Search in DBGrid on fkLookUp field

Incremental Search in DBGrid on fkLookUp field

In a TBDGrid, I have a column which is a fkLookup field.  When focused on
this column, the user presses F2, to enter edit mode, then clicks the drop
down arrow to display a list of possible values.  When the drop list is
displayed, the user can incrementally search through the list using the
keyboard.  Btw, the this is the only way to enter a value in the column,
i.e. the user cannot simply type it in without bringing up the picklist.

I would like to change the behaviour to allow the user to type directly into
the column, incrementally searching the lookup values after each keystroke,
without having to show the dropdown list.

Since the InplaceEditor is protected, and is not declared in the interface
section, what is the best method to change its behavior?

Also, this behavior could be extended for those columns where
TCloumn.PickList is assigned.  Or is this assigned already for fkLookup
fields?

John

 

Re:Incremental Search in DBGrid on fkLookUp field


On Mon, 16 Aug 1999 14:04:31 -0400, "John N Cox"

Quote
<j...@jcent.com.dontspamme> wrote:
>Since the InplaceEditor is protected, and is not declared in the interface
>section, what is the best method to change its behavior?

You'll have to subclass both TDBGrid (or TCustomDBGrid if you wish)
and TInplaceEdit.  You can get your TDBGrid descendant to use your
TInplaceEdit descendant by overriding the CreateEditor method.

Unfortunately, since TDBGrid actually uses the private
TDBGridInplaceEdit, you'll have to copy some source code from
dbgrids.pas to get your TInplaceEdit descendant behave the same.

Jan

Re:Incremental Search in DBGrid on fkLookUp field


Thanks Jan, this is the approach that I am working on now.  It is good to
know that someone is thinking along the same lines.   Thanks for your
response.

John

Re:Incremental Search in DBGrid on fkLookUp field


Why not use dbLookupComboBox, you can write in the field, it brigs the
looked up value while you type, but it does that only on the 1st letter.
Sraya

John N Cox <j...@jcent.com.dontspamme> wrote in message
news:7p9jeu$pe913@forums.borland.com...

Quote
> In a TBDGrid, I have a column which is a fkLookup field.  When focused on
> this column, the user presses F2, to enter edit mode, then clicks the drop
> down arrow to display a list of possible values.  When the drop list is
> displayed, the user can incrementally search through the list using the
> keyboard.  Btw, the this is the only way to enter a value in the column,
> i.e. the user cannot simply type it in without bringing up the picklist.

> I would like to change the behaviour to allow the user to type directly
into
> the column, incrementally searching the lookup values after each
keystroke,
> without having to show the dropdown list.

> Since the InplaceEditor is protected, and is not declared in the interface
> section, what is the best method to change its behavior?

> Also, this behavior could be extended for those columns where
> TCloumn.PickList is assigned.  Or is this assigned already for fkLookup
> fields?

> John

Other Threads