Combo box in TStringGrid?

Is it possible have a combo box for certain columns of a TStringGrid? If not, what is another approach I can use to display a 'pick list' to the user within a TStringGrid?
ChrisGinAsked:
Who is Participating?
 
mheacockConnect With a Mentor Commented:
This is not really an 'easy' question, but I'll give it a shot.

I might put a special string in cells that would contain the pick grid, perhaps "<choose>".

When someone selected a cell with "<choose>" in it, you would unhide a combo box you have on your form and place it in the appropriate place on the grid and allow the user to choose a string.  This placing of the combo box would be a very involved procedure...doable, but difficult.

Second you would need a 2D array of TStringLists (or TLists) for the number of rows/columns in your grid...these lists would either be empty, or contain the pick lists for the appropriate cells.

Other than placing the ComboBox, this is probably the the simplest/best solution.  TStringGrid on its own will not support what you desire...you could take the TStringGrid source code and alter it to your desires to create a new TStringComboGrid component.
0
 
ChrisGinAuthor Commented:
Hmm, that's a pity - I thought there might be an 'easy' way since  it is used extensively in Delphi's Object Inspector. Do you know how the Object Inspector was created?
0
 
mheacockCommented:
I don't think the Object Inspector is a string grid.  It behaves and reacts differently to mouse clicks and selections.  It looks like a specially designed component.
0
All Courses

From novice to tech pro — start learning today.