Jump to content

UniStringGrid Select First Row


ravedadave

Recommended Posts

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:

 

Link to comment
Share on other sites

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.

Untitled.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...