How do you set up a click event on a TStringGrid column header (fixed) so visually it looks like you are pressing a button

StackOverflow https://stackoverflow.com/questions/9210066

  •  27-04-2021
  •  | 
  •  

Question

I am working with Lazarus v0.9.30. I have a TForm with a TStringGrid on it. I have a fixed row in the grid, which is where I have all of my column headers. Each column is a TGridColumn object and each column title is a TGridColumnTitleObject. When looking in the object inspector there are no events you can use for TGridColumnTitle. What I want to do is to be able to click on the column header and visually I want it to look like you are pressing a button. I want to intercept the click event and then perform an action on it (eg. sort by column text, or perhaps display a help screen). Is there a way to do this?

Was it helpful?

Solution

On your grid set the Options.goHeaderPushedLook property to True.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top