Recent

Author Topic: DBLookUpComboBox  (Read 6435 times)

bambamns

  • Full Member
  • ***
  • Posts: 223
DBLookUpComboBox
« on: April 17, 2014, 04:13:55 am »
Hi,

In my app I use DBLookUpComboBox to display content of small tables and to let user choose one value.
To move cursor in database to chosen value , usually I put QueryQ.Locate('field',DBLookupComboBox.Caption,[]); in CloseUp event.

Does anyone know smarter way to do this ?

Thx
Lazarus 1.8.4 + FPC 2.6.4 x86 (rebuild) and Lazarus 2.0, Windows 7 x64, unless otherwise specified

jhvhs

  • New Member
  • *
  • Posts: 18
Re: DBLookUpComboBox
« Reply #1 on: April 17, 2014, 04:35:46 am »
Hi bambamns,

The TDBLookupComboBox is meant to change a value in one data set using values from another dataset. So if you are trying to use it as a single-column squashed data grid, I presume you have found a nice way of doing it.

Good luck!

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: DBLookUpComboBox
« Reply #2 on: April 17, 2014, 06:27:11 am »
Hi,

In my app I use DBLookUpComboBox to display content of small tables and to let user choose one value.
To move cursor in database to chosen value , usually I put QueryQ.Locate('field',DBLookupComboBox.Caption,[]); in CloseUp event.

Does anyone know smarter way to do this ?

Thx

DBLookupComboBox.KeyValue should return the value you want no reason to use locate.
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

bambamns

  • Full Member
  • ***
  • Posts: 223
Re: DBLookUpComboBox
« Reply #3 on: April 17, 2014, 07:36:11 am »
Quote
DBLookupComboBox.KeyValue should return the value you want no reason to use locate.

Yes, but if I need value from some other field in table (like ID), I need to use locate to position the cursor.
Lazarus 1.8.4 + FPC 2.6.4 x86 (rebuild) and Lazarus 2.0, Windows 7 x64, unless otherwise specified

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: DBLookUpComboBox
« Reply #4 on: April 17, 2014, 07:42:18 am »
no, the cursor should already be in the correct record in the listsource dataset.
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

eara

  • Jr. Member
  • **
  • Posts: 84
Re: DBLookUpComboBox
« Reply #5 on: April 17, 2014, 08:50:07 am »
@bambamns: Have you tried to set the .KeyField property in designer for TDBLookUpComboBox ?

« Last Edit: April 17, 2014, 09:27:41 am by eara »

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: DBLookUpComboBox
« Reply #6 on: April 17, 2014, 09:12:14 am »
No, currently I'm not using any data aware controls. Why do you have problems with it?
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

mangakissa

  • Hero Member
  • *****
  • Posts: 1131
Re: DBLookUpComboBox
« Reply #7 on: April 17, 2014, 01:23:21 pm »
Taaz is waiting for livebindings  :D :D
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

bambamns

  • Full Member
  • ***
  • Posts: 223
Re: DBLookUpComboBox
« Reply #8 on: April 17, 2014, 09:17:02 pm »
Yes, I have set ListSource , ListField and KeyField.

I see all the values in table field, but, as I wrote, when I choose one value , the cursor in table is not moving, so I have to move it by locate - this is natural for DBLookUpComboBox - My question is thare another, easy way (without locate) to do it.
Lazarus 1.8.4 + FPC 2.6.4 x86 (rebuild) and Lazarus 2.0, Windows 7 x64, unless otherwise specified

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: DBLookUpComboBox
« Reply #9 on: April 17, 2014, 09:47:45 pm »
Is the lookupCache property set to true?
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

bambamns

  • Full Member
  • ***
  • Posts: 223
Re: DBLookUpComboBox
« Reply #10 on: April 18, 2014, 06:13:11 am »
LookupCahche is on default false, but if I change it to true, it is the same - no change to cursor position in database.
Lazarus 1.8.4 + FPC 2.6.4 x86 (rebuild) and Lazarus 2.0, Windows 7 x64, unless otherwise specified

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: DBLookUpComboBox
« Reply #11 on: April 18, 2014, 06:22:43 am »
can you provide a small demo I'm interested in taking a closer look this is what I consider a bug that needs to be reported.
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

bambamns

  • Full Member
  • ***
  • Posts: 223
Re: DBLookUpComboBox
« Reply #12 on: April 18, 2014, 07:36:01 am »
Yes - in att.

When we speak about bug there is one connected with style property - I 'd made report http://bugs.freepascal.org/view.php?id=26006 , but this is just graphical thing (this is for wince, but it is the same issue on windows - you can see it on this demo).

To use this demo you need sqlite3.dll - is it too big to att. so you can download it from https://sqlite.org/2014/sqlite-dll-win32-x86-3080403.zip
« Last Edit: April 18, 2014, 07:37:44 am by bambamns »
Lazarus 1.8.4 + FPC 2.6.4 x86 (rebuild) and Lazarus 2.0, Windows 7 x64, unless otherwise specified

 

TinyPortal © 2005-2018