benibela / treelistview

A Pascal treelistview component, showing a treeview together with the columns of a listview (for Delphi and Lazarus)
52 stars 18 forks source link

Popup shows twice #6

Open artem78 opened 2 weeks ago

artem78 commented 2 weeks ago

When you add PopupMenu component to TreeListView and press left mouse button on it popup will be shown twice.

I add breakpoint to OnPopup event. Stacktrace for first call: 20241114_181145

and for second: 20241114_181152

Tested with Lazarus 2.2.4, FPC 3.2.2, Windows 7 64 bit

artem78 commented 2 weeks ago

I found solution: PopupMenu.AutoPopup property should be set to False.

benibela commented 2 weeks ago

there is a define for that:

https://github.com/benibela/treelistview/blob/f512e3c9af3e3e0e11ace7e7848b6074a9a1019c/TreeListView.pas#L26

perhaps it was for lcl versions that did not implement AutoPopup. I do not know if it would break something if change the default

artem78 commented 2 weeks ago

Maybe it would better to add LCL version check here like this?

{$if (lcl_fullversion >= 2000600)}
DoSomething(); // only do this for Lazarus 2.0.6 or later
{$endif}
benibela commented 1 week ago

that might have been better, but I do not remember for which lcl version that was for. It was like 15 years ago

artem78 commented 1 week ago

It was like 15 years ago

I think nobody still use too old Lazarus and you can simply remove this line.

artem78 commented 1 week ago

or just comment