
Procedure KeyPress(var Key: Char) override Procedure SwitchCell(_Col, _Row: Integer) But I didn’t want to install it, so I made it an interposer class instead. So, what else can we do? Create a component that descends from TStringGrid of course. I won’t go into this preliminary solution too much because the next step was to make this easier to use than having to set up the events each time I want to use it. I used a TImageList with two images for the bitmaps and set the cells that represent an on/off state to ‘0’ and ‘1’ (I could have used ‘Y’ and ‘N’ but ‘0’ and ‘1’ nicely correspond to the indices in the ImageList.) OnKeyPress for intercepting keyboard presses.OnMouseDown for intercepting mouse clicks.Adding a few events got me what I wanted: So I replaced the TListView with a TStringGrid. I’m a fan of using the keyboard, so this was a no no. I started out with a TListView in report view but when it came to switching with the keyboard I realized that I could only select the first column (or the whole row). (If you are an experienced component developer, expect to be bored by this article.

In addition it should allow the user to switch the states using the mouse and the keyboard. It mixes text with two different bitmaps, representing an on/off state. Today I had a need for a grid that looks like this:
