Recent

Author Topic: Listview1.SelectAll doesn't work in Cocoa  (Read 1855 times)

han

  • Jr. Member
  • **
  • Posts: 96
Listview1.SelectAll doesn't work in Cocoa
« on: May 17, 2020, 04:23:50 pm »

The method
Code: [Select]
Listview1.SelectAll
doesn't work in Cocoa. It works in Windows and Linux.

I also tried:

Code: [Select]
procedure select_all(tt :tlistview);
var
  i:integer;
begin
  tt.Items.BeginUpdate;
  for i := 0 to tt.Items.Count-1 do tt.Items[i].Selected:=true;
  tt.Items.EndUpdate;
  tt.setfocus;{set focus for next ctrl-C. Somehow it is lost}
end;

Anybody an idea how to get this working?

Han

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Listview1.SelectAll doesn't work in Cocoa
« Reply #1 on: May 18, 2020, 10:21:15 am »
Confirmed.

Code: Pascal  [Select][+][-]
  1. procedure TfrmMain.ListView1SelectItem(Sender: TObject; Item: TListItem;
  2.   Selected: Boolean);
  3. begin
  4.      Inc(count);
  5.      if(count <= 10) then
  6.        ListView1.Items[count].Selected:=true;
  7.      WriteLn('Count: ' + IntToStr(ListView1.SelCount));
  8. end;    
  9.  

SelectAll does not select any, but it does fire the SelectItem event the right number of times :)

Putting the ListView1.Items[count].Selected:=true; in the event handler only selects Item 11 (the last allowed in this test with 100 items).

Best log a bug report.

han

  • Jr. Member
  • **
  • Posts: 96
Re: Listview1.SelectAll doesn't work in Cocoa
« Reply #2 on: May 18, 2020, 10:35:21 am »
Thanks for confirming. I will raise a bug report:

https://bugs.freepascal.org/view.php?id=37103
« Last Edit: May 18, 2020, 10:51:32 am by han »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Listview1.SelectAll doesn't work in Cocoa
« Reply #3 on: May 18, 2020, 01:48:44 pm »
is MultiSelect property of ListView set to true?

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Listview1.SelectAll doesn't work in Cocoa
« Reply #4 on: May 18, 2020, 03:04:27 pm »
Yes, in my test it was set true. Once in the OI and once in code, to be sure, to be sure.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Listview1.SelectAll doesn't work in Cocoa
« Reply #5 on: May 18, 2020, 04:10:34 pm »
Yes, in my test it was set true. Once in the OI and once in code, to be sure, to be sure.
how does it work on r63183?

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Listview1.SelectAll doesn't work in Cocoa
« Reply #6 on: May 19, 2020, 12:11:52 am »
Fails to compile :(

Code: [Select]
Compiling cocoawscomctrls.pas
Compiling cocoatabcontrols.pas
cocoatabcontrols.pas(161,3) Note: Local variable "r" not used
cocoatabcontrols.pas(242,3) Note: Local variable "x" not used
cocoatabcontrols.pas(242,5) Note: Local variable "y" not used
cocoatabcontrols.pas(251,3) Note: Local variable "v" not used
cocoatabcontrols.pas(437,3) Note: Local variable "idx" not used
cocoatabcontrols.pas(480,3) Note: Local variable "r" not used
Assembling (pipe) ../../units/x86_64-darwin/cocoa/cocoatabcontrols.s
<stdin>:51526:10: warning: section "__datacoal_nt" is deprecated
.section __DATA, __datacoal_nt, coalesced
         ^      ~~~~~~~~~~~~~~
<stdin>:51526:10: note: change section name to "__data"
.section __DATA, __datacoal_nt, coalesced
         ^      ~~~~~~~~~~~~~~
<stdin>:51575:10: warning: section "__datacoal_nt" is deprecated
.section __DATA, __datacoal_nt, coalesced
         ^      ~~~~~~~~~~~~~~
<stdin>:51575:10: note: change section name to "__data"
.section __DATA, __datacoal_nt, coalesced
         ^      ~~~~~~~~~~~~~~
cocoawscomctrls.pas(639,3) Note: Local variable "lTitle" not used
cocoawscomctrls.pas(818,13) Warning: Range check error while evaluating constants (9223372036854775807 must be between -2147483648 and 2147483647)
cocoawscomctrls.pas(896,3) Note: Local variable "lOldTabStyle" is assigned but never used
cocoawscomctrls.pas(909,3) Note: Local variable "lOldTabStyle" is assigned but never used
cocoawscomctrls.pas(1305,3) Warning: Case statement does not handle all possible cases
cocoawscomctrls.pas(1559,3) Fatal: Syntax error, ";" expected but "ELSE" found
Fatal: Compilation aborted
make[3]: *** [../lcl.ppu] Error 1
make[2]: *** [cocoa_all] Error 2
make[1]: *** [interfaces] Error 2
make: *** [lcl] Error 2
trev@macmini6 [/Users/trev/lazarus-src] $

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Listview1.SelectAll doesn't work in Cocoa
« Reply #7 on: May 19, 2020, 02:30:36 am »
hmm. odd. r63184

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Listview1.SelectAll doesn't work in Cocoa
« Reply #8 on: May 19, 2020, 02:42:09 am »
Compiles and now SelectALL selects all - see pic :)

 

TinyPortal © 2005-2018