StringGrid: add selection via code lazarus / 31-LCL ---------------------------------------------------------------------- SirTwist · 2019-06-23 19:37 Hi all, I have a TStringGrid (actually a derived StringGrid...) and want to add rows to the selection by program code. The StringGrid is configured to have Multi Ranges (RangeSelectMode = rsmMulti), that's how I try to emulate "MultiSelect" in Listboxes or ListViews. When the user changes selection via mouse, I can read SelectedRangeCount and SelectedRange\[i\]. But I want to add rows (or cells) [edited:] to the selection ranges via code. Is there any way to add SelectedRanges? Kind regards, SirTwist ---------------------------------------------------------------------- jamie · 2019-06-23 19:53 [Overview][Constants][Types][Classes][Procedures and functions][Variables][Index]   Reference for unit 'Grids' (#lcl) TCustomStringGrid.InsertRowWithValues Declaration Source position: grids.pas line 1723 public procedure TCustomStringGrid.InsertRowWithValues(   Index: Integer;   Values: array of string ); ---------------------------------------------------------------------- SirTwist · 2019-06-23 21:06 Ah, I'm sorry, my mistake. I do not want to add new rows to the StringGrid, but add rows to the selection. ---------------------------------------------------------------------- jamie · 2019-06-24 01:10 well, you already know it  Selection! Selection:TRect....  Read it to give you the selection, write it to set it. I am going to bed, good night