Onchange in edit box makes trouble lazarus / 8-Other ---------------------------------------------------------------------- tortho · 2007-01-30 09:03 Hi, I'm using the onchange in an edit box to change/search in a TListView... The problem is that the onchange is activated at the time of loading the form... and i then also have not loaded the file filling the listview. The program then stops due to no items in the list... How can i either do something so the onchange does not trigger something at the time of loading the form, or can I bypass it some other way.. I want to use the onchange, but sometimes the listview needs to be empty. Thanks ---------------------------------------------------------------------- Vincent Snijders · 2007-01-30 11:05 You can test if the listview has items by using TListView.Items.Count. ---------------------------------------------------------------------- eric · 2007-01-30 13:56 Alternatively you can leave the edit box OnChange event unassigned, then explicitly assign it after the data has been loaded: Edit1.OnChange := @Edit1Change; Eric ---------------------------------------------------------------------- Bart · 2007-01-31 10:35 Some time ago i posted this bug http://www.freepascal.org/mantis/view.php?id=2068 It is marked as resolved now ( 2006-12-06 00:53      Marc Weustink      Status      resolved => closed) What Lazarus version are you using? You can reopen the bug, by pressing on the "Reopen Issue" button in the above link (you must have an acoount for the bug tracker). Bart ---------------------------------------------------------------------- Marc · 2007-01-31 11:25 iirc, you cannot reopen closed bugs (and if so, only the original reporter can) ---------------------------------------------------------------------- Bart · 2007-01-31 13:23 Quote from: "tortho"The problem is that the onchange is activated at the time of loading the form...I just tested this in Linux with Laz 0.9.20: The Edit.OnChange is not called, neither in the FormCreate nor the FormShow. Wether or not the Edit contains any text at startup does not matter for the OnChange, however if the Edit contains text, the modifed property becomes true. I'm not sure if it really should be in this case... [Edit]Now I'm back  in Windows Laz 0.9.20. Somewhere between FormCreate and FormShow the Edit's OnChange gets fired, even if the Edit contains no text. This obviously is wrong. I just now reopend the bugreport and asked for feedback. Bart ---------------------------------------------------------------------- Bart · 2007-01-31 14:36 Quote from: "Marc"iirc, you cannot reopen closed bugs (and if so, only the original reporter can)A "Reopen Issue" button would not make any sense on an issue that wasn't closed now would it I assume that if only the OP can reopen it, then the button will only appear to the OP. (I'm just a litltle bored today, so I have nothing better to do than post this silly reply ...) Bart ---------------------------------------------------------------------- Bart · 2007-02-01 17:42 Good news! From Bugtracker: 2007-01-31 17:02 Fixed in Version => 0.9.21 (SVN) That's what I call quick response, yeah! I'll wait for the next stable one (0.9.22) to retest this, I'm just not into this SVN thingy ;-) Bart ---------------------------------------------------------------------- Vincent Snijders · 2007-02-02 07:48 Quote from: "Bart"G I'll wait for the next stable one (0.9.22) to retest this, I'm just not into this SVN thingy ;-) For such people exists snapshots.