Jump to content


Photo

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


  • Please log in to reply
10 replies to this topic

#1 jameswong

jameswong

    Active Member

  • Members
  • PipPipPip
  • 56 posts

Posted 20 April 2016 - 02:58 AM

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


  • 0

#2 Farshad Mohajeri

Farshad Mohajeri

    Administrator

  • Administrators
  • 9874 posts

Posted 20 April 2016 - 04:06 AM

Set ClearButton -> False.


  • 0

#3 jameswong

jameswong

    Active Member

  • Members
  • PipPipPip
  • 56 posts

Posted 20 April 2016 - 05:53 AM

i use unidbgrid, does the dbgrid have ClearButton?

Set ClearButton -> False.


  • 0

#4 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3648 posts

Posted 20 April 2016 - 06:32 AM

Hi,

 

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

 

For example:

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

Best regards.


  • 0

#5 jameswong

jameswong

    Active Member

  • Members
  • PipPipPip
  • 56 posts

Posted 20 April 2016 - 06:56 AM

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.


  • 0

#6 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3648 posts

Posted 20 April 2016 - 09:23 AM

You want to add "x" ?!


  • 0

#7 jameswong

jameswong

    Active Member

  • Members
  • PipPipPip
  • 56 posts

Posted 21 April 2016 - 05:41 AM

no, i don't use UniDBLookupComboBox1.I create a field which kind is looupup because i need to display name and save id.  how to  ​cancel "x"

You want to add "x" ?!


  • 0

#8 arilotta

arilotta

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 66 posts
  • LocationTrieste, Italy

Posted 05 December 2017 - 04:12 PM

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


  • 0

#9 arilotta

arilotta

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 66 posts
  • LocationTrieste, Italy

Posted 06 December 2017 - 03:16 PM

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


  • 0

#10 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3648 posts

Posted 07 December 2017 - 10:09 AM

Hi,

 

If I understand you correctly, please see this demo:

\FMSoft\Framework\uniGUI\Demos\Desktop\GridWithDBLookupCombo

Best regards,


  • 0

#11 arilotta

arilotta

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 66 posts
  • LocationTrieste, Italy

Posted 07 December 2017 - 10:30 AM

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


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users