Recent

Author Topic: (SOLVED) DBGrid dlookup question  (Read 4392 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
(SOLVED) DBGrid dlookup question
« on: September 15, 2017, 09:23:38 pm »
Hi guys, I created a lookup field in a dbgrid. It works fine, but if I have so many records in the lookup list I need to be able to filter it by pressing the keys. Does anyone tell me how to do it? The example contains a few lines, hypothesized instead of showing a list of 1000 articles in the lookup, so you can select the desired value by scrolling it with the mouse.

Anyone know how to help me? Thank you
« Last Edit: September 18, 2017, 10:52:49 am by xinyiman »
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: DBGrid dlookup question
« Reply #1 on: September 16, 2017, 03:15:24 pm »
No suggestion?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: DBGrid dlookup question
« Reply #2 on: September 16, 2017, 03:29:39 pm »
I usually do not filter my lookup fields, I make sure that they are sorted by the description field and I'm using the locate function to auto-select the first closest value in the dataset. I haven't looked at the posted code yet but in order for a filter to work you need to make sure that it is cleared when the master dataset is scrolled to a new record and the record packets are set to 0 forcing a "retrieve all" when open, otherwise the results will be sketchy at best.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: DBGrid dlookup question
« Reply #3 on: September 16, 2017, 05:04:18 pm »
@taazz: can you change my example using the locate? Because I can not get it to work. Thanks, it's very important to me
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: DBGrid dlookup question
« Reply #4 on: September 16, 2017, 05:07:31 pm »
I'll se what I ca ndo later tonight at home.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: DBGrid dlookup question
« Reply #5 on: September 16, 2017, 05:19:33 pm »
Thanks so much
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: DBGrid dlookup question
« Reply #6 on: September 17, 2017, 10:50:39 am »
@taazz: news?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: DBGrid dlookup question
« Reply #7 on: September 17, 2017, 11:02:33 am »
I didn't had much time yesterday, I only installed zeos data objects added more names and jobs to help in testing and the rest today. I will start by adding an external dblookupcombo and making it work there, after that I'll embed the same logic in the dbgrid editor. Sorry, it will take a bit longer than I planed.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: DBGrid dlookup question
« Reply #8 on: September 17, 2017, 11:29:34 am »
She does nothing, look.
Appearance
Thanks so much
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: DBGrid dlookup question
« Reply #9 on: September 17, 2017, 07:41:08 pm »
Find attached the first results. Is this sufficient or should I try to implement filtering as well?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: DBGrid dlookup question
« Reply #10 on: September 18, 2017, 10:52:36 am »
Thank you taazz! Is perfect  ;)
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018