Jump to content

How to cancel "×" on the lookup field when dropdown


jameswong

Recommended Posts

Hi,

 

On the UniDBLookupComboBox, which is the editor for your lookupfield,

 

For example:

UniDBLookupComboBox1.ClearButton => [False]
UniDBGrid1.Columns[yourLFieldIndx].Editor => [UniDBLookupComboBox1]

Best regards.

Link to comment
Share on other sites

but  i don't use UniDBLookupComboBox1, i create a field which kind is looupup. i see the demo of dbgridlookup( not  UniDBLookupComboBox) which have not clearbutton, how to do that

Hi,

 

On the UniDBLookupComboBox, which is the editor for your lookupfield,

 

For example:

UniDBLookupComboBox1.ClearButton => [False]
UniDBGrid1.Columns[yourLFieldIndx].Editor => [UniDBLookupComboBox1]

Best regards.

Link to comment
Share on other sites

  • 1 year later...

Hi Delphi Dev, I found this old thread.

I would like to add the "x" to the automatically created DBLookupComboBox when the grid columns are bound to lookup fields.

At the moment, there is no possibility to empty (set NULL) the field, even by clearing the field contents with backspace.

Hoping there is a solution....

Thank you

Link to comment
Share on other sites

Hi Delphi Dev, 

from your samples, it is possible to bind a Dbgrid column to a lookup field to automatically produce a "DblookupCombo" editor, without the need

to specify explicitely the editor in the Editor property of the column.

This automatically "runtime generated " dblookupcombo does not provide you with the ClearButton, AnyMatch, etc. options.

Is that right ?

However, I've discovered that it is possible to explicitely specify in the Editor property for the column a "design time created" DBLookkupComboBox,

bound with DataSource to the same Grid datasource and DataField to the field underlying the lookup field (key).

In this way it is possible to deeply configure the "design time created" DBLookkupComboBox, using ClearButton, AnyMatch, maybe RemoteQuery, etc.

 

In browse mode, the grid column is filled by the LookupField, while in Edit mode the data editing is managed by the  "design time created" DBLookkupComboBox.

 

Please confirm me that this is a possible solution without any drawbacks, I'm in a hurry because the deadline for the current project I'm working on is coming....

 

Thank you, as always.

Andrea

Link to comment
Share on other sites

Thank you for the reply. The demo shows a situation a bit different, and in fact not very common.

In the demo the field posted is "Name", while commonly in a lookup situation it is a numeric identifier (ID).

 

In this situation, to have the user see the name rather than the identifier, the grid column should be bound to a lookup field

to decode the identifier and show the value, correct ?

 

Thank you

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...