* * *

Author Topic: 1.8.0 + 1.9.0: TListView OnColumnClick does not fire  (Read 1772 times)

MISV

  • Sr. Member
  • ****
  • Posts: 453
1.8.0 + 1.9.0: TListView OnColumnClick does not fire
« on: December 11, 2017, 11:58:13 pm »
Not sure yet if this a Carbon specific issue (or old or new issue) - but on my Lazarus 1.8.0 Carbon + Lazarus 1.9.0 TLisView OnColumnClick does not fire when clicking headers - even with ColumnClick property is set to true.

Can anyone else reproduce this / recognize it and know how to solve it? I will submit as bug if anyone else maybe can confirm the issue.

It is kinda sad since TListView in version 1.9 has implemented support for CustomSort...
« Last Edit: February 05, 2018, 01:40:49 am by MISV »

MISV

  • Sr. Member
  • ****
  • Posts: 453
Re: 1.8.0 + 1.9.0: TListView OnColumnClick does not fire
« Reply #1 on: February 05, 2018, 01:41:17 am »
Bump (Sorry but just tested in version 1.9 trunk and problem persists)

I have tried to set breakpoints in TCustomListView.ColClick which do not fire

To make sure I am testing correctly I even deleted comctrls.pp and inserted a call to
Code: Pascal  [Select]
  1. Hide;
a beginning of ColClick ... But it simply does not fire

Is this a Carbon problem or general problem?
« Last Edit: February 05, 2018, 03:06:32 am by MISV »

jamie

  • Hero Member
  • *****
  • Posts: 920
Re: 1.8.0 + 1.9.0: TListView OnColumnClick does not fire
« Reply #2 on: February 05, 2018, 02:26:05 am »
You can implement the message handler for the "WM_NOTIFY" it could also be LM_NOTIFY

 test to see if you are receiving a LVN_COLUMNCLICK inside the WM_NOTIFY message

 its very possible it is not implemented.

MISV

  • Sr. Member
  • ****
  • Posts: 453
Re: 1.8.0 + 1.9.0: TListView OnColumnClick does not fire
« Reply #3 on: February 05, 2018, 03:09:34 am »
TCustomListView.CNNotify seems to implement LVN_ColumnClick - but well... Does not fire.

That would make it a Carbon issue - right? (i.e. whatever Carbon implementation details - it does not send such a message to the LCL system)

jamie

  • Hero Member
  • *****
  • Posts: 920
Re: 1.8.0 + 1.9.0: TListView OnColumnClick does not fire
« Reply #4 on: February 05, 2018, 03:55:25 am »
Yes, that would sound plausible  :D

MISV

  • Sr. Member
  • ****
  • Posts: 453
Re: 1.8.0 + 1.9.0: TListView OnColumnClick does not fire
« Reply #5 on: February 05, 2018, 12:25:44 pm »
Bugger :( Seems I may be out of luck then... Gah... need to go into thinking box. I use a listview many places. Will be a mess to replace with virtual tree  - in particular of Cocoa solves this when it arrives

Contemplating if something one could add to Carbon or if maybe there is a reason it is no triggering (some setting or similar - I do have ColumnClick True though)

MISV

  • Sr. Member
  • ****
  • Posts: 453
Re: 1.8.0 + 1.9.0: TListView OnColumnClick does not fire
« Reply #6 on: February 05, 2018, 03:04:26 pm »
If someone has an idea - please shoot though. My experiments using Cocoa early has failed so for time being I will be forced to Carbon.

I am trying to see if somehow other things are affecting behavior.
 

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: 1.8.0 + 1.9.0: TListView OnColumnClick does not fire
« Reply #7 on: February 05, 2018, 03:08:26 pm »
If someone has an idea - please shoot though. My experiments using Cocoa early has failed so for time being I will be forced to Carbon.

I see a recent bug report on Cocoa widgetset's TListView:

https://bugs.freepascal.org/view.php?id=33127

Add your comments to the bug report. Saying them here won't get it fixed.

MISV

  • Sr. Member
  • ****
  • Posts: 453
Re: 1.8.0 + 1.9.0: TListView OnColumnClick does not fire
« Reply #8 on: February 06, 2018, 01:49:57 am »
Sorry for all the disturbance. I see it is my own CNNotify that prevented it.

In my Delphi version I call inherited for messages I do not handle.

But when converting to Lazarus/Mac from Delphi/Windows I could not successfully call inherited (private) and had simply left that part... commented out.

Solution: Commenting out my entire CNNotify in Lazarus and everything seems to work.



For references for others - here is how to use:

Code: Pascal  [Select]
  1. procedure TFormExample.MyListViews_ColumnClick_EventHandler(Sender: TObject; Column: TListColumn);
  2. var
  3.   TmpIndex: Integer;
  4.   {$IFDEF mymsFPCDevTool}
  5.   TmpCallBackCompare: TLVCompare;
  6.   {$ENDIF}
  7. begin
  8.   if Column.Tag = 0 then
  9.     Column.Tag := 1
  10.   else
  11.     Column.Tag := 0
  12.   ;
  13.   TListView(Sender).Tag := Column.Tag;
  14.   TmpIndex := Column.Index;
  15.   //--
  16.   {$IFDEF mymsDELPHI}
  17.   TListView(Sender).CustomSort(nil, TmpIndex);
  18.   {$ENDIF}
  19.   {$IFDEF mymsFPCDevTool}
  20.   //--
  21.   // NOTE: CustomSort added in Lazarus 1.9: https://bugs.freepascal.org/view.php?id=8536
  22.   // NOTE: If passing *nil* Lazarus will use *0* as columnidx to oncompare handler no matter what - so we need to set both
  23.   //--
  24.   TmpCallBackCompare := @imfLView_4Compare_LCL;
  25.   TListView(Sender).CustomSort(TmpCallBackCompare, TmpIndex);
  26.   {$ENDIF}
  27. end;
  28.  
« Last Edit: February 06, 2018, 01:36:00 pm by MISV »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus