
| Subject: | D6 striggrid and combobox |
| Posted by: | Takacs Gabor |
| Date: | Fri, 30 Jan 2009 |
I use in Delphi6 (with service packs installed) a stringgrid with a column that the user can
edit with a dropdown list (csDropDownList style). I use the tip suggested by Peter Below (in his very useful PeterBelow.chm file) with small modification. I placed the ComboBox showing in the stringgrid Getedittext event, so the user can see the Combobox only when he goes editing the cell. It works but there is a weird thing.
At the first cell editing, the combobox appears and drops down (the default selected combo item is the same as it was in the cell), but not the programaticaly seleted item showed as selected.
The edit box of the combo (and the first element of the dropdown list) is that the program selects, but not that shows with the selection color. If I close the combo and go bak to the cell
and go to edit it again the the combo selection seems correct (the firs item in the dropdown list has the selection color). I copy the program lines which makes this process in the GetEditText event
with wcm do begin // wcm is the combobox
itemindex:=j; // j is the selected item
Show;
BringTofront;
// focus the combobox and drop down the list
SetFocus;
DroppedDown := true;
end;
I tried to make invalidate, repaint but non of them helped.
Can anybody suggest me something that can help?
Thank you in advanced,