dblookuplist question lazarus / 16-Databases ---------------------------------------------------------------------- daveinhull · 2019-12-11 01:05 Hi, I've just gone back to a development which worked, burr now the DBLookupList isn't working.  I can't select a list item or multiple list items,  where previously I could and it worked.  When I select an item it highlights but then immediately dehighlights? Has anyone else seen this? Thanks Dave ---------------------------------------------------------------------- daveinhull · 2019-12-12 09:21 Any thoughts on this? ---------------------------------------------------------------------- devEric69 · 2019-12-12 10:16 Hello, what do you call a dbLookupList: a dbLookupListBox? ---------------------------------------------------------------------- Handoko · 2019-12-12 10:51 @daveinhull Do you have a backup? Maybe you accidentally modified something, so it doesn't work now. Try the code from backup first. ---------------------------------------------------------------------- daveinhull · 2019-12-12 23:15 Hi @Handomo, Thanks for the comment and suggestion. Yes I tried a backup and I also tried adding a new component ,but it does the same thing. I'm using the latest version of Lazarus. Can someone confirm that they have it working, then I guess I know it's my error. Thanks Dave ---------------------------------------------------------------------- wp · 2019-12-12 23:26 If you'd provide a compilable project here (ideally simplified and using only a standard database) I could try to verify the issue. ---------------------------------------------------------------------- sash · 2019-12-14 13:26 tl;dr; https://bugs.freepascal.org/view.php?id=35069 Is it this case? If so, it is broken at last from spring 2019. Initially, I reported it as minor one, although in fact it is important (I had to switch to another control), but unfortunately I can't change bug priority. ---------------------------------------------------------------------- daveinhull · 2019-12-15 12:44 Hi sash, Yes that looks like it. I've attached a zip file with a simple test programe to show the problem. I've just used an access database (also included). If I've missed something from the zip file please let me know. PS this is on wndows. Hope someone can fix it :-) Dave ---------------------------------------------------------------------- korba812 · 2019-12-15 14:38 This is not a bug. You have not set DataSource and DataField properties. It doesn't work without these properties, just like TDBEdit or other data-aware controls. ---------------------------------------------------------------------- wp · 2019-12-15 15:14 Quote from: daveinhull on December 15, 2019, 01:44:11 pmHi sash, Yes that looks like it. I've attached a zip file with a simple test programe to show the problem. I've just used an access database (also included). If I've missed something from the zip file please let me know. PS this is on wndows. Hope someone can fix it :-) Dave Strange demo: database not connected, dataset not active, no code - why do you need the Access database after all? But it reminds me of the "unbound use"  of the DBLookuoCombobox. I do remember that there was an issue, and I think it has been fixed. And indeed, I do not see the issue when I compile and run your demo with Laz trunk, but I do see the reported behavior with Laz 2.0.6. Looking at the svn commit notes of dblookuplistbox.inc there is a commit by Juha which might have fixed it (r61111, May 3 2019). In the discussion of the report there are some open points which might have been the reason why the report has not been resolved and thus did not make it into v2.0.6. Please test the issue with Lazarus trunk and confirm that the issue is solved indeed, and also that there are no sideeffects - fixing bugs in the data-aware controls really is a pain! ---------------------------------------------------------------------- korba812 · 2019-12-15 15:38 In my opinion, there is no such thing like "unbounded data controls". Data-aware controls are designed to operate with a selected data field (properties DataSource,DataField) and what they display closely reflects value of indicated data field. So if you need a combo box with items coming from database just use TComboBox and populate items from dataset. ---------------------------------------------------------------------- wp · 2019-12-15 15:51 Quote from: korba812 on December 15, 2019, 04:38:39 pmIn my opinion, there is no such thing like "unbounded data controls". Data-aware controls are designed to operate with a selected data field (properties DataSource,DataField) and what they display closely reflects value of indicated data field. I forgot to add the wiki link: https://wiki.freepascal.org/TDBLookupComboBox#Unbound_use. The word "unbound" is maybe misleading, but have only one dataset attached to a lookup control, instead of two, DOES make sense in some cases. ---------------------------------------------------------------------- korba812 · 2019-12-15 16:33 Quote from: wp on December 15, 2019, 04:51:56 pmI forgot to add the wiki link: https://wiki.freepascal.org/TDBLookupComboBox#Unbound_use. The word "unbound" is maybe misleading, but have only one dataset attached to a lookup control, instead of two, DOES make sense in some cases. Maybe just use some in-memory dataset for this purpose? It would be simpler and clearer than the advice from wiki page. I know that Delphi allows unbounded lookup controls, but lookup controls in delphi have a completely different architecture. But I think it is a bug that was used as a feature (side effect?). ---------------------------------------------------------------------- daveinhull · 2019-12-16 08:24 All, @wp, Don't understand, everything is connected and active in my version!!! Don't need code to just show you the problem with trying to set multiple list entries. Ok, so how do you store multiple selected list items in a data feild? What I was doing, maybe wrongly, was catching the on click, finding out which list entries had been set, creating a list and storing the list in the database field - wrong??? I thought I was trying it with trunk, isn't that the official released version, v2.0.6? Dave ---------------------------------------------------------------------- wp · 2019-12-16 10:16 Quote from: daveinhull on December 16, 2019, 09:24:00 amDon't understand, everything is connected and active in my version!!! I downloaded your zip again and looked at the LFM file again, but now outside the IDE. Yes, you are right: the ODBCConnection has Connected = true, the database file is specified in its Params.Strings, and the Query is Active. But when I load your project into the IDE, the ODBConnection.Connected is false, and the Query.Active is false, as well. What's going on here? It is the way you specify the location of the database file. You specify it as a relative path. This is wrong, never use relative paths in relation to database components. At designtime this is relative to the Lazarus folder! I wonder how you were able to establish the ODBCConnection in the first place. Therefore, I was missing code in the FormCreate event or similar, to explicitly open the database: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormCreate(Sender: TObject);begin  ODBCConnection1.Connected := true;  SQLQuery1.Active := true;end; With this event handler in place I can see the items in the LookupListbox. And using Laz trunk (-- see below, on what that is) every item can be selected, and the selection does not disappear after each click (I cannot select several items, and I doubt if that is possible because there is nothing like "MultiSelect" or so among the properties of the DBLookupListBox). When I compile with Laz 2.0.6 I see the behavior that you describe: When I press the mouse button on an item the item is highlighted, but when I release the mouse button, the highlight goes away. Laz trunk is the development version, i.e. the version into to all new code is added primarily, all new features, all bug fixes. Laz 2.0.6 is the last release version, i.e. a snapshot of the trunk version taken some time ago when the developers decided: "OK, let's release this now". When bugs appear after taking this snapshot and releasing the version their fixes are copied from the trunk version to a special branch of the version tree called "Fixes". It always has odd version numbers, i.e. it is version 2.0.7 for the current release. From time to time a new release of the bug-fixed version will be published, now with an odd number again, here: 2.0.8. "Your" bug is a bit complicated. According to the svn commit notes, it has been fixed in trunk, but there seem to open issues (https://bugs.freepascal.org/view.php?id=35458). Or it simply has been forgotten - we're only human...). As a consequence, the issue has not been "resolved", and without this step the patch is not back-ported to fixes. I'll contact Jesus Reyes to whom the original issue has been assign. ---------------------------------------------------------------------- daveinhull · 2019-12-17 01:14 Hi @wp QuoteIt is the way you specify the location of the database file. You specify it as a relative path. This is wrong, never use relative paths in relation to database components. At designtime this is relative to the Lazarus folder! I wonder how you were able to establish the ODBCConnection in the first place. No, you said to produce a simple quick example whic is what I did - it was not meant to be production code. I normally have the FormCreat code to do all the activations, but again, this was just to illustrate the problem Quote(I cannot select several items, and I doubt if that is possible because there is nothing like "MultiSelect" or so among the properties of the DBLookupListBox). It sed to be possible as I had the code working a year ro so ago. QuoteWhen I compile with Laz 2.0.6 I see the behavior that you describe: When I press the mouse button on an item the item is highlighted, but when I release the mouse button, the highlight goes away.Yes this is exacl-tly what is happening. However, it also happened on my last installed version (can't now remember what it was). When I came back to the project it started happening so I decided to update to V2.0.6, and still the problem. QuoteI'll contact Jesus Reyes to whom the original issue has been assign.Thanks What about the issue over unbounded control and my reason for doing so. As I said it was possible to have multiple selections (honest!) and if so how would these be stored in a single bounded field? Thans for your help Dave ---------------------------------------------------------------------- daveinhull · 2020-03-10 10:55 Hello, Sorry for the delay in checking back on this. Does anyone know if this issue has been fixed, i.e. not being able to select from a list? Also, are there binary versions of the daily builds available like there used to be? Many thanks Dave