Recent

Author Topic: Custom edit in DBGrid problem  (Read 3623 times)

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
Custom edit in DBGrid problem
« on: December 18, 2018, 12:48:58 pm »
Hi,

I've been tryin gto figure this out for ages, but finally thought best to ask the experts.

I have a DBGrid where I've included a customer RxDBLookupCombo as the cell editor, all works fine except when I come to a new record.

When I enter the new record and move to the customer combo cell editor, it of course takes focus, whereby immediately the underlying DBGrid thinks I've exited without entering anything so it then drops the insert leaving the combo box alone in blank space.

I've got around this by forcing another cell (a date cell which is needed) with a value to hold the newly inserted row, but of course if then nothing is actually entered the row is always there.

No great hardship as I can always just delete it, but it just doesn't remain consistent with normal behavior.

Anyone got any ideas on how this should really be done?

Thanks
Dave
« Last Edit: December 30, 2018, 05:24:15 pm by daveinhull »
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

balazsszekely

  • Guest
Re: Custom edit in DBGrid problem
« Reply #1 on: December 18, 2018, 06:54:40 pm »
Anyone got any ideas on how this should really be done?
Set Grid-->Options-->dgCancelOnExit to false?

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
Re: Custom edit in DBGrid problem
« Reply #2 on: December 23, 2018, 09:37:04 am »
Hi GetMem - Excellent and such a simple answer, many thanks  :)

I've read all the tutorials for databases etc, but I just can'd the basic help on many of the controls, for example where is this and the other options defined?

Thanks
Dave
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Custom edit in DBGrid problem
« Reply #3 on: December 24, 2018, 12:00:29 pm »
Look at your Object Inspector
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
Re: Custom edit in DBGrid problem
« Reply #4 on: December 24, 2018, 12:44:24 pm »
Hi madref,

Sorry what I meant was where is it defined in the documentation the reference manual etc. I know where it is in the Object INspector and I;ve got it to work.

Thanks
Dave
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

dsiders

  • Hero Member
  • *****
  • Posts: 1052
Re: Custom edit in DBGrid problem
« Reply #5 on: December 24, 2018, 09:19:49 pm »
Sorry what I meant was where is it defined in the documentation the reference manual etc

Unfortunately, dgCancelOnExit is not documented in the LCL reference for TDBGrid or TDBGridOptions. You could try looking on the Wiki (if you have the patience and a fair amount of luck).
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
Re: Custom edit in DBGrid problem
« Reply #6 on: December 24, 2018, 11:33:46 pm »
 ;D hmmmm as I thought! Thanks anyway.
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Custom edit in DBGrid problem
« Reply #7 on: December 28, 2018, 04:48:54 pm »
Hi madref,

Sorry what I meant was where is it defined in the documentation the reference manual etc. I know where it is in the Object INspector and I;ve got it to work.

Thanks
Dave


Haha, No problem at all. We are all here to help each other and sometimes words get mixed up. 8)
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

sierdolg

  • New Member
  • *
  • Posts: 21
Re: Custom edit in DBGrid problem
« Reply #8 on: March 27, 2019, 12:49:13 pm »
Dear daveinhull,

to "have DBGrid where I've included a customer RxDBLookupCombo as the cell editor" is just my concern, too. (I need autoselect, which RxDBLookupCombo offers and the default cell editor does not).

The first question, if that is possible at all, therefore is already answered ,-)

For me as a beginner in the OO world, the second question remains open: how to do that? (Derive your own component from TDBGrid?)

You said it so nicely in your first post, it's best to ask the experts:
May I therefore ask you for a short guidance or a working minimal example?

 

TinyPortal © 2005-2018