Jump to content


Photo

SelectNone not working in TNextGrid v6.0.55


  • Please log in to reply
2 replies to this topic

#1 czbird

czbird
  • Members
  • 58 posts

Posted 05 October 2017 - 11:58 AM

Hi,

just updated first grid to TNextGrid6, and replaced old NoSelection call with new SelectNone in my code.

 

I click on a single row in the grid, and it gets selected.

Then I call SelectNone -- the row still remains selected

Then when I click on any other row in the grid, it properly gets selected, but the first row still remains displayed as selected.

 

 

What's wrong?

Thanks

 

EDIT -- So, it only works when multiple rows are selected (gtMultiSelected in FState)... but it does not work when just single row is selected... why is that?



#2 czbird

czbird
  • Members
  • 58 posts

Posted 05 October 2017 - 12:10 PM

Posting updated code to make this work as I expected...

procedure TNxCustomGrid6.SelectNone(DelayedRefresh: Boolean);
var
  i: Integer;
begin
  if gtMultiSelected in FState then begin
    try
      if DelayedRefresh then BeginUpdate([]);
    	for i := 0 to Pred(RowCount)
        do Selected[i] := False;
      Exclude(FState, gtMultiSelected);
    finally
      if DelayedRefresh then EndUpdate;
    end;
  end
  // BEGIN_CODE_UPDATE czbird@2017-10-05 added this so that it works also when just 1 row is selected
  else
    if FSelectedRow <> -1 then Selected[FSelectedRow] := False;
  // END_CODE_UPDATE

  FSelectedCol := -1;
  FSelectedRow := -1;
end;


#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 10 October 2017 - 08:02 PM

Hi,

I will give it a test and if all is ok I will include your fix for future release.

Thanks
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users