Recent

Author Topic: 2.2 RC1: Virtual listview "Selected" incompatible at MultiSelect  (Read 27482 times)

d7_2_laz

  • Hero Member
  • *****
  • Posts: 506
Ok - additinally a regular listview added to the test project here
Lazarus 3.2  FPC 3.2.2 Win10 64bit

wp

  • Hero Member
  • *****
  • Posts: 11830
Did it myself in the meantime. Reopened the old bug report: https://bugs.freepascal.org/view.php?id=34877

I could create a user in mantis and enter (and assign) it there, but i don't intend to install additional development subsystems (ie. trunk, version control systems) on my host), at least not these days.
In order to report a bug you do not have to install anything.
« Last Edit: July 18, 2021, 12:51:14 pm by wp »

d7_2_laz

  • Hero Member
  • *****
  • Posts: 506
*Thousand* thanks again wp!
About the bug tickets, i'll remember [but would never do it without a review cycle in the forum, just as now).
Lazarus 3.2  FPC 3.2.2 Win10 64bit

wp

  • Hero Member
  • *****
  • Posts: 11830
There is a patch in https://bugs.freepascal.org/view.php?id=34877#c131930; in my tests it solves the issue. Can you confirm?

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
I fixed also the other bug I found. Now "Selected" returns the first selected item also in virtual mode. Please test.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

d7_2_laz

  • Hero Member
  • *****
  • Posts: 506
Saw it ... congratulations and big compliments!   :)
Confirmed, works fine with the testcase as well ss within the prog!
Wouldn't have expected that the solution would arrive so fast - wow! :)
Lazarus 3.2  FPC 3.2.2 Win10 64bit

d7_2_laz

  • Hero Member
  • *****
  • Posts: 506
Unfortunately i encountered a remaining little flaw in the solution.

Scenario - i added some small IFs in wp's use case -:
- click on an item in the middle of the list, eg. "capt_5"
- click on the empty space in the listview. Here all would be ok so far.
- click on the LAST item in the list, here: "capt_9"
- click on the empty space in the listview. The item identified by capt_9  keeps to have Item.Selected is true

The last item in the list is not set to Item.Selected - false when Selected became nil.
The effect is, that if you rely on Item.Selected is correct whereas it isn't, then some subsequent program steps will fail.
Lazarus 3.2  FPC 3.2.2 Win10 64bit

d7_2_laz

  • Hero Member
  • *****
  • Posts: 506
Thought about to make a note in the bug tracker's item, but as the system is just being in progress to be migrated, i leave it to you if it should be corrected.
The solution itself is a good step forwards.
The little flaw oberrvation could be workarounded in a program via:
on Click event:

Code: Pascal  [Select][+][-]
  1.   if Selected = nil then
  2.      Items[Items.Count-1].Selected := False;
Lazarus 3.2  FPC 3.2.2 Win10 64bit

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
Thought about to make a note in the bug tracker's item, but as the system is just being in progress to be migrated, i leave it to you if it should be corrected.
I reopened issue:
 https://bugs.freepascal.org/view.php?id=34877
Please copy your findings into a note there.
You found a workaround. Maybe you could fix it properly as well and provide a patch.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

d7_2_laz

  • Hero Member
  • *****
  • Posts: 506
No idea how to make TCustomListView.CNNotify fully functional but i added added a note in the bug tracker item.
Lazarus 3.2  FPC 3.2.2 Win10 64bit

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
No idea how to make TCustomListView.CNNotify fully functional
LCL code can be debugged, too.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

dsiders

  • Hero Member
  • *****
  • Posts: 1045
No idea how to make TCustomListView.CNNotify fully functional but i added added a note in the bug tracker item.

I think the widgetset implementations of GetItemAt are wrong (in TWin32WSCustomListView and TWinCEWSCustomListView).

Code: Pascal  [Select][+][-]
  1. class function TWin32WSCustomListView.GetItemAt(const ALV: TCustomListView; x,  y: Integer): Integer;
  2. var  HitInfo: LV_HITTESTINFO;
  3. begin
  4.   Result := -1;
  5.   if not WSCheckHandleAllocated(ALV, 'GetItemAt') then Exit;
  6.  
  7.   HitInfo.pt.x:=x;
  8.   HitInfo.pt.y:=y;
  9.   ListView_HitTest(alv.Handle,HitInfo);
  10.   if HitInfo.flags <> LVHT_NOWHERE then Result:=HitInfo.iItem;
  11. end;
  12.  


should probably be:

Code: Pascal  [Select][+][-]
  1. if (HitInfo.flags and LVHT_NOWHERE) <> 0 then Result:=HitInfo.iItem;

I tried it on my Trunk install. OnClick reports selected as being Nil and the selection is removed when I click on a non-item area. It doesn't trigger OnSelectItem or OnChange though. It does fire OnChange and  OnSelectItem.
« Last Edit: July 19, 2021, 09:06:55 pm by dsiders »
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

d7_2_laz

  • Hero Member
  • *****
  • Posts: 506
Compiling for Windows x64?  I didn't notice any difference after applying the change, do a "compile new" and using the testcase (listview_virtualMode_multiselect_wp_mod.zip) just as described (click on the last listitem, click on nowhere, and the messagebox still appears telling that for the last item Selected is still true).
Lazarus 3.2  FPC 3.2.2 Win10 64bit

dsiders

  • Hero Member
  • *****
  • Posts: 1045
Compiling for Windows x64?  I didn't notice any difference after applying the change, do a "compile new" and using the testcase (listview_virtualMode_multiselect_wp_mod.zip) just as described (click on the last listitem, click on nowhere, and the messagebox still appears telling that for the last item Selected is still true).

Then we are seeing different results. Try running Tools > Configure Build > Clean All  + Build to force LCL to be rebuilt.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

d7_2_laz

  • Hero Member
  • *****
  • Posts: 506
Had this already donw for to avoid old code could have been loaded, but it diid not change.
The best is i'll await a retest with RC2 for to avoid confustion.
Should be no problem, a temporary workaround is available-
Lazarus 3.2  FPC 3.2.2 Win10 64bit

 

TinyPortal © 2005-2018