Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2018-01

fixes_1_8 - DBLookupComboBox broken

14 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Gabor Boros

Hi All,

I have a Linux-Qt application and if compile with fixes_1_8 rev 56990 or later the DBLookupComboBox not working as before. Can drop down it and select from the items with the mouse but the selection not showed. The problem not appears with rev 56987.

Gabor

Reply by email

Juha Manninen
to Gabor Boros
Gabor Boros wrote
I have a Linux-Qt application and if compile with fixes_1_8 rev 56990 or later the DBLookupComboBox not working as before. Can drop down it and select from the items with the mouse but the selection not showed. The problem not appears with rev 56987.

Is it related to this?
https://bugs.freepascal.org/view.php?id=32943

Rev 56987 in 1_8_fixes is:
"Translations: updated all LazReport translations from trunk" and does not affect DBLookupComboBox.

Juha

Reply by email

Werner Pamler
to Gabor Boros: I have a Linux-Qt application and if compile with fixes_1_8 rev 56990 or later the…
Gabor Boros wrote 6 lines
Hi All, I have a Linux-Qt application and if compile with fixes_1_8 rev 56990 or later the DBLookupComboBox not working as before. Can drop down it and select from the items with the mouse but the selection not showed. The problem not appears with rev 56987.

Could you check out the attached demo? It works for me with Laz trunk and fixes (both r57032) on Windows and Linux GTK2/QT (trunk tested only). The left grid shows the main dataset, the right grid is the lookup dataset. The lookup combo is at the bottom. Select an item from the combo and the CountryCode field should update accordingly. Also rotating the mouse wheel over the combobox works.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dblookupcombo_mousewheel.zip
Type: application/x-zip-compressed
Size: 2421 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180110/14ebd41a/attachment.bin>

Reply by email

Gabor Boros
to Juha Manninen: On Wed, Jan 10, 2018 at 6:47 PM, Gabor Boros via Lazarus Is it related to this?…

2018. 01. 10. 18:50 keltezéssel, Juha Manninen via Lazarus írta:

I don't know. Attached a simple example. With it I can reproduce the problem on Windows too. So the problem is not Qt specific.

Rev 56987 in 1_8_fixes is: "Translations: updated all LazReport translations from trunk" and does not affect DBLookupComboBox.

Yes. 56987 is the last revision which works as expected.

Gabor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DBLookupComboBox.tar.gz
Type: application/x-gzip
Size: 1570 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180110/e4e8310d/attachment.bin>

Reply by email

Gabor Boros
to Werner Pamler: Could you check out the attached demo? It works for me with Laz trunk and fixes (both…

2018. 01. 10. 20:06 keltezéssel, Werner Pamler via Lazarus írta:

Show quoted text 6 lines
Could you check out the attached demo? It works for me with Laz trunk and fixes (both r57032) on Windows and Linux GTK2/QT (trunk tested only). The left grid shows the main dataset, the right grid is the lookup dataset. The lookup combo is at the bottom. Select an item from the combo and the CountryCode field should update accordingly. Also rotating the mouse wheel over the combobox works.

Tried with fixes_1_8 56990 on Windows. Works as expected.

Gabor

Reply by email

Werner Pamler
to Gabor Boros: 2018. 01. 10. 18:50 keltezéssel, Juha Manninen via Lazarus írta: I don't know. Attached…
Gabor Boros wrote
I don't know. Attached a simple example. With it I can reproduce the problem on Windows too. So the problem is not Qt specific.

You did not assign a Datasource to the DBLookupCombo. This is where the value picked from the combo is stored to. Without a Datasource I consider the present hehavior to be correct.

Maybe another dev can comment who is more familiar with databases than me.

Reply by email

Werner Pamler
to Werner Pamler
Werner Pamler wrote 10 lines
Am 10.01.2018 um 20:21 schrieb Gabor Boros via Lazarus: > I don't know. Attached a simple example. With it I can reproduce the > problem on Windows too. So the problem is not Qt specific. You did not assign a Datasource to the DBLookupCombo. This is where the value picked from the combo is stored to. Without a Datasource I consider the present hehavior to be correct. Maybe another dev can comment who is more familiar with databases than me.

And I should mention this: The code which I had to merge manually in r56990 was the same code which Juha had added in 55911 to dblookupcombobox.inc in order to "respect ReadOnly property in TDBLookupComboBox and TDBLookupListBox". And a data-aware control which is not linked to a DataSource is readonly, isn't it?

Reply by email

Michael Thompson

On 11 January 2018 at 05:18, Werner Pamler via Lazarus <

Show quoted text 17 lines
wrote: Am 10.01.2018 um 21:57 schrieb Werner Pamler via Lazarus: > Am 10.01.2018 um 20:21 schrieb Gabor Boros via Lazarus: > >> I don't know. Attached a simple example. With it I can reproduce the >> problem on Windows too. So the problem is not Qt specific. >> > > You did not assign a Datasource to the DBLookupCombo. This is where the > value picked from the combo is stored to. Without a Datasource I consider > the present hehavior to be correct. > > Maybe another dev can comment who is more familiar with databases than me. >

I'm experiencing issues with this control as well. I'm also not assigning Datasource. Not assigned Datasource is a valid use for this control, with several Delphi and Lazarus examples out there, including on our wiki. Unbound use is used for keeping the active record in a dataset syncronised with the contents of the DBLookupCombobox.

The code I'm using was derived from here:

http://wiki.freepascal.org/TDBLookupComboBox#Unbound_use

I've not investigated the code supplied by by Gabor Boros, but in my case the combobox looks fine, until you change selection, then all entries in the Combobox are cleared and no OnScroll is fired in the List Datasource.

For now I've worked around this by adding a Dummy TBufDataset. I'm pointing the DBLookupCombo.Datasource to the TBufDataset, and the datafield to a variant field in TBufDataset.

This kind of works, though I'm now experiencing a random AccessViolation. The code I've quickly inserted the TBufDataset workaround into is complex (I'm cascading multiple DBLookupCombobox's, changing one affects all others after it), and I inserted the TBufDataset workaround in a hurry. For now, I'm assuming the memory issue is mine.

I plan on looking at Gabor's code tonight, see if we're experiencing the same issue.

Cheers

Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180111/bb699477/attachment.html>

Reply by email

Gabor Boros
to Werner Pamler: You did not assign a Datasource to the DBLookupCombo. This is where the value picked from…

2018. 01. 10. 21:57 keltezéssel, Werner Pamler via Lazarus írta:

You did not assign a Datasource to the DBLookupCombo. This is where the value picked from the combo is stored to. Without a Datasource I consider the present hehavior to be correct.

I use the DBLookupComboBox without DataSource always in the past 10-20 years with Lazarus and Delphi.

From the TDBLookupComboBox's wiki page:

"Unbound use - You can get the combobox to look up values from one table without storing the results in another by leaving the DataSource and the KeyField properties empty."

http://wiki.freepascal.org/TDBLookupComboBox#Unbound_use

From my POV, unacceptable if a fix broke a feature in a fixes_* branch after x.y.0 version released from it.

Gabor

Reply by email

Werner Pamler
to Gabor Boros
Gabor Boros wrote
From my POV, unacceptable if a fix broke a feature in a fixes_* branch after x.y.0 version released from it.

Sorry for the inconvenience. Call it "unacceptable" or not - that's the way things are, nobody is perfect.

Please open "dblookupcombobox.inc" (in (lazarus)/lcl/include), find the method TDBLookupCombobox.Select and replace it by the following code which restores the code before r56990/r55911 for the case that the lookupcombobox is not ReadOnly. Your demo works here. Please test carefully - as you see I don't have any experience with that ominous Unbound mode...

procedure TDBLookupComboBox.Select;
begin
   FDataLink.OnDataChange := nil;
   try
     if FDataLink.Edit then
     begin
        FDataLink.Modified;
        FDataLink.UpdateData;
        inherited Select;
     end
     else
     begin
        // if cannot modify, let it reset
        if ReadOnly then begin
          FDatalink.Reset;
          DataChange(Self);
        end else begin
          FDataLink.Modified;
          inherited Select;
        end;
     end;
   finally
     FDataLink.OnDataChange := @DataChange;
   end;
end;

Reply by email

Gabor Boros
to Werner Pamler

2018. 01. 11. 12:22 keltezéssel, Werner Pamler via Lazarus írta:

Show quoted text 6 lines
Am 11.01.2018 um 10:14 schrieb Gabor Boros via Lazarus: > From my POV, unacceptable if a fix broke a feature in a fixes_* branch > after x.y.0 version released from it. Sorry for the inconvenience. Call it "unacceptable" or not - that's the way things are, nobody is perfect.

I have no problem with you just with the broken feature. ;-)

Show quoted text 7 lines
Please open "dblookupcombobox.inc" (in (lazarus)/lcl/include), find the method TDBLookupCombobox.Select and replace it by the following code which restores the code before r56990/r55911 for the case that the lookupcombobox is not ReadOnly. Your demo works here. Please test carefully - as you see I don't have any experience with that ominous Unbound mode...

I switched to the latest fixes_1_8 (57037) and replaced TDBLookupCombobox.Select with the provided code. After that DBLookupCombobox works as expected for me at first try. I use it daily and will report if see problem with it.

Thank you!

Gabor

Reply by email

Michael Thompson
to Werner Pamler: Sorry for the inconvenience. Call it "unacceptable" or not - that's the way things are,…

On 11 January 2018 at 19:22, Werner Pamler via Lazarus <

Show quoted text 8 lines
wrote: Please open "dblookupcombobox.inc" (in (lazarus)/lcl/include), find the method TDBLookupCombobox.Select and replace it by the following code which restores the code before r56990/r55911 for the case that the lookupcombobox is not ReadOnly. Your demo works here. Please test carefully - as you see I don't have any experience with that ominous Unbound mode...

Many thanks. Applying the code to my copy of Trunk (and then removing my TBufDataset workaround) appears to have completely resolved my issues with TDBLookupCombobox as well.

Cheers

Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180112/8f0fe7ba/attachment.html>

Reply by email

Werner Pamler
to Michael Thompson
Michael Thompson wrote 15 lines
On 11 January 2018 at 19:22, Werner Pamler via Lazarus < <mailto:>> wrote: Please open "dblookupcombobox.inc" (in (lazarus)/lcl/include), find the method TDBLookupCombobox.Select and replace it by the following code which restores the code before r56990/r55911 for the case that the lookupcombobox is not ReadOnly. Your demo works here. Please test carefully - as you see I don't have any experience with that ominous Unbound mode... Many thanks.  Applying the code to my copy of Trunk (and then removing my TBufDataset workaround) appears to have completely resolved my issues with TDBLookupCombobox as well.

I committed the fix to trunk (r57060) and requested backporting to fixes. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180112/89d9edfe/attachment.html>

Reply by email