Board index » delphi » DBGrig toggling the Selected row in a mutiselect

DBGrig toggling the Selected row in a mutiselect

Hi All,
   I am trying to us a dbgrid to allow the user to select multiple
records to process. I have gotten the gist of how to make this happen. I
just want to know if there is a way to toggle the selected state of a
row with a specific key, say the spacebar. The dbgrid is set to read
only so it only being used for this purpose.

Thanks
Sean

 

Re:DBGrig toggling the Selected row in a mutiselect


Quote
>   I am trying to us a dbgrid to allow the user to select multiple
>records to process. I have gotten the gist of how to make this happen. I
>just want to know if there is a way to toggle the selected state of a
>row with a specific key, say the spacebar. The dbgrid is set to read
>only so it only being used for this purpose.

The code to select the current row is.

Grid1.selectedRows.CurrentRowSelected := true;

The code to toggle the current row would be

With Grid1 do begin
   selectedRows.CurrentRowSelected :=  Not (selectedRows.CurrentRowSelected)
end;

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Other Threads