Recent

Author Topic: [SOLVED] TDBLookupCombobox, OnChange event didn't triggered  (Read 536 times)

incendio

  • Sr. Member
  • ****
  • Posts: 266
[SOLVED] TDBLookupCombobox, OnChange event didn't triggered
« on: April 12, 2022, 05:06:49 am »
Hi guys,

I am using IBX on Lazarus 2.0.12 on Windows 10 with Firebird 3 database.

I have a TDBLookupCombobox in my form, listsource, listfield, and keyfield point to a TIBQuery.

The app runs OK, but there are something strange with TDBLookupCombobox. I can changed its value, but the OnChange Event didn't triggered.

I also have a button with this code
Code: Pascal  [Select][+][-]
  1. procedure TRptIntFrm.PreviewBtnClick(Sender: TObject);
  2. begin
  3.   ShowMessage(QRptRPTNM.AsString);
  4. end;
  5.  

When clicked after changed combobox value, Showmessage always return the first record value of QRpt.

Any idea how to correct this?

Thanks in advace.
« Last Edit: April 12, 2022, 07:13:35 am by incendio »

GAN

  • Sr. Member
  • ****
  • Posts: 370
Re: TDBLookupCombobox, OnChange event didn't triggered
« Reply #1 on: April 12, 2022, 06:02:37 am »
Code: Pascal  [Select][+][-]
  1. I have a TDBLookupCombobox in my form, listsource, listfield, and keyfield point to a TIBQuery.

Do the same with DataField and DataSource.
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

incendio

  • Sr. Member
  • ****
  • Posts: 266
Re: TDBLookupCombobox, OnChange event didn't triggered
« Reply #2 on: April 12, 2022, 06:28:16 am »
Code: Pascal  [Select][+][-]
  1. I have a TDBLookupCombobox in my form, listsource, listfield, and keyfield point to a TIBQuery.

Do the same with DataField and DataSource.
On Combobox, I don't think set ListSource and Datasource to the same dataset is a good idea.

Although it could triggered OnChange event, but it was only work with TSQLQuery, not worked with IBX, also, this way, even the property ScrollistDataset set to true, Dataset not scrolled.

I think this is a bug.
« Last Edit: April 12, 2022, 06:50:31 am by incendio »

incendio

  • Sr. Member
  • ****
  • Posts: 266
Re: TDBLookupCombobox, OnChange event didn't triggered
« Reply #3 on: April 12, 2022, 07:13:09 am »
Found a solution, didn't use OnChange event, instead, used OnSelect Event, seem to get the job done.

Thanks everyone.

 

TinyPortal © 2005-2018