Recent

Author Topic: OnItemClick does not work properly  (Read 5419 times)

Peiman

  • New Member
  • *
  • Posts: 41
OnItemClick does not work properly
« on: March 04, 2011, 11:58:06 am »
Hi, everyone!

I have a checklistbox which I want to control both checking and selecting it. So I have assigned both onclickcheck and onitemclick events to it.

When I click on an item, nothing happens (the onitemclick is not working), but when I check or uncheck an item, both of the events are evoked (first clickcheck and then itemclick).

Lazarus version : 0.9.31 >> fpc 2.5.1 >> win 7 64bit

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: OnItemClick does not work properly
« Reply #1 on: March 04, 2011, 12:33:26 pm »
Fill an issue on mantis about it and attach example project.

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: OnItemClick does not work properly
« Reply #2 on: March 04, 2011, 12:45:29 pm »
I can confirm on Qt.

Click on Check gives (I mean only the small square on the left):
OnClickCheck
OnItemClick
OnClick

Click on Check's caption (I mean the text):
OnClick only
(here I would expect InItemClick)

Click out of items (I mean white space around):
OnClick only

Lazarus 0.9.31 r29708M FPC 2.5.1 x86_64-linux-qt
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: OnItemClick does not work properly
« Reply #3 on: March 04, 2011, 01:09:18 pm »
Qt implementation followed gtk2 and win32 implementation.

Peiman

  • New Member
  • *
  • Posts: 41
Re: OnItemClick does not work properly
« Reply #4 on: March 04, 2011, 01:14:10 pm »
thank you.

Blaazan is right, clicking on item only runs Onclick. I think it is a bug of FPC 2.5.1. To temporarily solve it I used a higher level variable (checking):

Code: [Select]
var
  checking : boolean;
...
procedure ....clickcheck(...); onclickcheck
  begin
  checking := true;
  ...
  end;

procedure ....click(...); // onclick
  begin
  if not (checking) then
    ...
  checking := false;
  end;

 

TinyPortal © 2005-2018