ravedadave Posted March 14, 2023 Share Posted March 14, 2023 Hi, I have a UniStringGrid after preparing the grid with all the relivant data, I would like to automatically select the first row (so it shows as highlighted), currently none is until you click it. Any hints would be appreciated. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 14, 2023 Share Posted March 14, 2023 38 minutes ago, ravedadave said: I have a UniStringGrid after preparing the grid with all the relivant data, I would like to automatically select the first row (so it shows as highlighted), currently none is until you click it. Hello, This post may help you: Quote Link to comment Share on other sites More sharing options...
ravedadave Posted March 14, 2023 Author Share Posted March 14, 2023 Hi Sherzod, Thanks for the reply, It didn't help, I'm not trying to unselect anything. I have attached a screenshot, Everytime the grid loads no line is selected until you click it. When I make a change in the comboboxes and reload the grid the same happens. I just want the first vehicle row to be automatically highlighted on a change. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 14, 2023 Share Posted March 14, 2023 2 minutes ago, ravedadave said: and reload the grid UniStringGrid do you mean? Quote Link to comment Share on other sites More sharing options...
ravedadave Posted March 14, 2023 Author Share Posted March 14, 2023 Hi Yes. I do this via: ind := mans.ItemIndex; modInd := mods.ItemIndex; SumGrid.RowCount := NewVehicleroot.Manufacturers[ind].models[modInd].vehicles.Count+1; For I := 0 to NewVehicleroot.Manufacturers[ind].models[modInd].vehicles.Count-1 Do Begin SumGrid.BeginUpdate; SumGrid.Cells[0,I+1] := NewVehicleroot.Manufacturers[ind].models[modInd].vehicles[i].description; SumGrid.Cells[1,I+1] := NewVehicleroot.Manufacturers[ind].models[modInd].vehicles[i].qtyAvailable.ToString; SumGrid.Cells[2,I+1] := NewVehicleroot.Manufacturers[ind].models[modInd].vehicles[i].colour; SumGrid.Cells[3,I+1] := NewVehicleroot.Manufacturers[ind].models[modInd].vehicles[i].termSummary; SumGrid.Cells[4,I+1] := NewVehicleroot.Manufacturers[ind].models[modInd].vehicles[i].status; SumGrid.Cells[5,I+1] := IntToStr(I); SumGrid.EndUpdate; End; SumGrid.Row := 1; I assumed SumGrid.Row selected the row but doesn't highlight it. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 14, 2023 Share Posted March 14, 2023 1 minute ago, ravedadave said: SumGrid.Row := 1; This should work, also keep in mind that the Row is zero based. Quote Link to comment Share on other sites More sharing options...
ravedadave Posted March 14, 2023 Author Share Posted March 14, 2023 Hi that's the problem it doesn't Row 0 is the titles. I have tried using FixedRows too. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 14, 2023 Share Posted March 14, 2023 Could you please make a simple testcase? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.