TCheckListBox events triggered oddly (Win10) lazarus / 31-LCL ---------------------------------------------------------------------- PaulRowntree · 2018-09-02 23:20 There are three single click-related events in TCheckListBox OnCLick, which is fired when any part of the Control is clicked OnClickCheck, which is fired when the check box is clicked OnItemClick, which is fired when any part of the entry is clicked (check box or item text) is clicked. This seems to duplicate OnClick If you click the check region all three are fired (OnClick, then OnClickCheck, then OnItemClick) None of these are fired by a single click on the text.  Wouldn't this be expected to fire OnItemClick? If OnClick is handled, OnDblClick is never called. Is this the expected behaviour? Thanks! ---------------------------------------------------------------------- Blaazen · 2018-09-03 00:55 What widgetset? I tested on Qt and GTk2 and: OnClick is fired when any part of the Control is clicked. OnClickCheck is fired when the check box is clicked. OnItemClick is also fired when the check box is clicked - duplicate of OnClickCheck. If I click the check region all three are fired but with different order on Qt and GTk2. Only OnClick is fired when I click text. OnDblClick is fired as expected in whole area (checkbox, text or the rest). EDIT: Win10, I noticed now. BTW, Delphi has no OnItemClick. EDIT2: You can visit bugtracker and search for "CheckListBox", there are two pages of bugreports (but 90% are resolved or closed). ---------------------------------------------------------------------- PaulRowntree · 2018-09-03 01:21 Quote from: Blaazen on September 03, 2018, 02:55:23 amWhat widgetset? I tested on Qt and GTk2 and: OnClick is fired when any part of the Control is clicked. OnClickCheck is fired when the check box is clicked. OnItemClick is also fired when the check box is clicked - duplicate of OnClickCheck. If I click the check region all three are fired but with different order on Qt and GTk2. Only OnClick is fired when I click text. OnDblClick is fired as expected in whole area (checkbox, text or the rest). Thanks for the quick reply Blaazen 1) Widget set is Win32.  The application is Win64, Laz 1.8.3 2) DoubleClick : This is odd.  I put a ShowMessage() in each of the handlers to show when it is called.  With those ShowMessage lines disabled, I see the dblClick being fired as you say.  But when ShowMessage lines are enabled, there is no message coming from the dblClick handler.  I do see the ShowMessage dialog window flash oddly under these conditions (and the windows sounds is heard), but no dblClick ShowMessage.  Weird, but I presume OK once we get past diagnostics 3) Confirmed that all three events are fired when the checkbox region is clicked.4) Confirmed that ItemCheck is called when the check region is clicked Would you expect that ItemClicked should be fired when the text is clicked?  If not, it seems redundant : what is it for?Cheers!pr ---------------------------------------------------------------------- lucamar · 2018-09-03 01:45 Quote from: PaulRowntree on September 03, 2018, 03:21:18 am2) DoubleClick : This is odd.  I put a ShowMessage() in each of the handlers to show when it is called.  With those ShowMessage lines [...] Instead of ShowMesssage(), try setting a more permanent (and normal) response when each is called. For example a couple of TLabels, one for each event, or a multiline edit control, if you want to see in which order the events are shot. Doing it this way would assure you of whether DblClick is indeed called. Can't help more, since I don't have Windows boxes around here ATM. One other little thing: please, don't use red-colored text: it becomes almost unreadable over the standard forum background---at least for people (like me) with bad sight. Bold text is enough to emphasize. ETA: Wait widgetset is Win32 and the application is 64 bit? That can't be. Or do you mean the application is 32 bit but running on Windows 10 64bit? ---------------------------------------------------------------------- Blaazen · 2018-09-03 01:50 I guess that OnDblClick can't be test with ShowMessage. It needs two clicks with small interval and if there is ShowMessage after the first OnClick then it is lost. Try to add ListBox on the form and add lines "OnClick" or "OnDblClick" to it instead of ShowMessages. ---------------------------------------------------------------------- PaulRowntree · 2018-09-03 01:58 Quote from: Blaazen on September 03, 2018, 03:50:08 amI guess that OnDblClick can't be test with ShowMessage. It needs two clicks with small interval and if there is ShowMessage after the first OnClick then it is lost. Try to add ListBox on the form and add lines "OnClick" or "OnDblClick" to it instead of ShowMessages. I think you're right.  The dblClick does work as expected. Any thoughts on ItemClick ?  I would really like to know if the text has been selected, apart from the checkbox.Cheers! ---------------------------------------------------------------------- lucamar · 2018-09-03 02:25 Quote from: PaulRowntree on September 03, 2018, 03:58:12 amAny thoughts on ItemClick ?  I would really like to know if the text has been selected, apart from the checkbox.Cheers! If just to discard a more general bug, can you try to see if it works in a simple ListBox? ---------------------------------------------------------------------- taazz · 2018-09-03 03:02 Quote from: PaulRowntree on September 03, 2018, 03:58:12 amQuote from: Blaazen on September 03, 2018, 03:50:08 amI guess that OnDblClick can't be test with ShowMessage. It needs two clicks with small interval and if there is ShowMessage after the first OnClick then it is lost. Try to add ListBox on the form and add lines "OnClick" or "OnDblClick" to it instead of ShowMessages. I think you're right.  The dblClick does work as expected. Any thoughts on ItemClick ?  I would really like to know if the text has been selected, apart from the checkbox.Cheers! Windows 7 lazarus 1.8.2 onitemclick is not raised when not clicked on the check box here is my test code 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.Button1Click(Sender: TObject);begin  ListBox1.Clear;end; procedure TForm1.Append(const aText :String);begin  ListBox1.Items.Add(aText);end; procedure TForm1.CheckListBox1Click(Sender :TObject);var  vMousePos :TPoint;  vItemClicked:Integer;begin  Append('OnClick');  vMousePos := TControl(Sender).ScreenToClient(Mouse.CursorPos);  vItemClicked := CheckListBox1.ItemAtPos(vMousePos,True);  if vItemClicked > -1 then Append('OnClick Item Clicked :' + IntToStr(vItemClicked));end; procedure TForm1.CheckListBox1ClickCheck(Sender :TObject);begin  Append('OnClickCheck');end; procedure TForm1.CheckListBox1DblClick(Sender :TObject);begin  Append('OnDblClick');end; procedure TForm1.CheckListBox1ItemClick(Sender :TObject; Index :integer);begin  Append('OnItemClick : '+ CheckListBox1.Items[Index]);end;  Its easy to reproduce the layout just drop a checklistbox, a listbox and a button on the form and fill in events shown above and of course a couple of items in the check list box Attached a gif that shows my results. ---------------------------------------------------------------------- ASerge · 2018-09-03 18:34 If you look at the sources, you can see that the OnItemClick and OnClickCheck events are called at the same time. Not very clear why made duplication. By the way, in Delphi no OnItemClick (in VCL). ---------------------------------------------------------------------- lucamar · 2018-09-03 18:43 Quote from: ASerge on September 03, 2018, 08:34:04 pmBy the way, in Delphi no OnItemClick (in VCL). IIRC correctly---I may not---Delphi had OnSelectionChange or something similarly called that performed the same task, at lest for TListBox. Can't investigate much more: most of my development machines have apparently decided to go on strike: something about the heat, I think...