Recent

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

d7_2_laz

  • Full Member
  • ***
  • Posts: 198
A overriden TCustomListView is my special target, so it's an essential part of the test case which i won't miss.
With or without "inherited" didn't make a difference, i previously had checked that.

Here a slighty improved version (with inherited and a Check on WM_CONTEXTMENU):

d7_2_laz

  • Full Member
  • ***
  • Posts: 198
Ok - additinally a regular listview added to the test project here

wp

  • Hero Member
  • *****
  • Posts: 8877
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 »
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

d7_2_laz

  • Full Member
  • ***
  • Posts: 198
*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).

wp

  • Hero Member
  • *****
  • Posts: 8877
There is a patch in https://bugs.freepascal.org/view.php?id=34877#c131930; in my tests it solves the issue. Can you confirm?
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3965
  • 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

  • Full Member
  • ***
  • Posts: 198
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! :)

d7_2_laz

  • Full Member
  • ***
  • Posts: 198
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.

d7_2_laz

  • Full Member
  • ***
  • Posts: 198
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;

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3965
  • 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

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

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3965
  • 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: 519
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 »
Lazarus 2.0.12, 2.2.0-RC1, 2.3.0 (Git) / FPC 3.2.0, 3.2.2 / x86-win64 / Windows 8.1

d7_2_laz

  • Full Member
  • ***
  • Posts: 198
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).

dsiders

  • Hero Member
  • *****
  • Posts: 519
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.
Lazarus 2.0.12, 2.2.0-RC1, 2.3.0 (Git) / FPC 3.2.0, 3.2.2 / x86-win64 / Windows 8.1

 

TinyPortal © 2005-2018