Recent

Author Topic: TDBLookupComboBox queries  (Read 3959 times)

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
TDBLookupComboBox queries
« on: September 16, 2017, 04:56:47 pm »
Hello All,

Hope someone can help here?

I'm using a TDBLookupComboBox bound to a field in a DataSource and with a separate ListSource and ListField.
All works as would expect except that when the program first runs nothing is shown in the control until I move to the next record and then I can go back to the first record and it shows the correct value.

Also, the height of the control appears to be locked or at least it can't be changed unless the font is changes - is this by design and if so, is there a particular reason?

Many thanks
Dave

P.S.
I'll set up my signature correctly, but I'm using Version #:1.6.4 Date 2017/02/17 FPC Version: 3.0.2 and SVN Revision 54278 for i386-win32-win32/win64
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

mizar

  • New Member
  • *
  • Posts: 35
Re: TDBLookupComboBox queries
« Reply #1 on: September 16, 2017, 09:24:33 pm »
I had the same issue some time ago:
http://forum.lazarus.freepascal.org/index.php/topic,30719.msg195629.html

By the way, you have to open the listsource dataset before opening the "master" dataset.

HTH

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
Re: TDBLookupComboBox queries
« Reply #2 on: September 17, 2017, 02:50:44 pm »
Many thanks mizar.

I did try searching for a previous thread, but didn't see your one.

I actually solved it (probably incorrectly) by adding an .Refresh (correction from .ApplyUpdates in the original post, sorry) to the master query in the .FormActivate handler.

All my setting are done through the properties in the Object Inspector (for now at least) as I just wanted to get back into Lazarus and FPC, so I'm not sure how to change the order of which opens first; is it the order in which they appear in the Object Inspector, in which case by moving them around I should be able to change the open sequence?

Any thoughts on why the height appears locked in the Object Inspector properties, and can I change it code?

Thanks again
Dave
« Last Edit: September 17, 2017, 03:05:24 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

mizar

  • New Member
  • *
  • Posts: 35
Re: TDBLookupComboBox queries
« Reply #3 on: September 24, 2017, 06:15:59 pm »
Sorry, I've read your reply just now...

First of all it would be better if you keep everything data related in a datamodule avoid cluttering your forms with data related components.

Btw, datamodule or forms, in oncreate or onactivate event:

DSMaster.Close //if ever opened
DSList.Close

DSList.Open
DSMaster.Open

Open order matters here!

 

TinyPortal © 2005-2018