Forum > LCL

Force Picklist in TStringGrid to drop down

(1/1)

bruce.button:
Is there a method/property that I can use to force a picklist in a TStringGrid cell to drop down?

I've looked quite hard, but I'm not sure if I need to look at the cell or column properties, or at the TStringGrid itself.

Thank you for the help!

jamie:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button1Click(Sender: TObject);begin StringGrid1.Editor :=  StringGrid1.EditorByStyle(cbsPickList); StringGrid1.Editor.Show; StringGrid1.Editor.Left := StringGrid1.CellRect(1,1).Left; StringGrid1.Editor.Top  := StringGrid1.CellRect(1,1).Top; STringGrid1.Editor.Width:= StringGrid1.CellRect(1,1).Width;end;                                                          
Something like this ?

bruce.button:

--- Quote from: jamie on June 05, 2023, 09:17:07 pm ---
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button1Click(Sender: TObject);begin StringGrid1.Editor :=  StringGrid1.EditorByStyle(cbsPickList); StringGrid1.Editor.Show; StringGrid1.Editor.Left := StringGrid1.CellRect(1,1).Left; StringGrid1.Editor.Top  := StringGrid1.CellRect(1,1).Top; STringGrid1.Editor.Width:= StringGrid1.CellRect(1,1).Width;end;                                                          
Something like this ?


--- End quote ---

Almost. I want to force that picklist to drop down - equivalent to pressing Alt-Down on the keyboard.

jamie:
The onSelectEditor gives you the control that is currently in place as far as Know.

When you reach that event you can do this.

TCustomCombobox(Editor).DroppedDown := true;

Of course it maybe a smart idea to first test it.

 Editor As TCustomCombobox.DroppedDown := True;

bruce.button:
Yes, that looks like the property I was looking for. I will certainly test it out!

Thanks again.

Navigation

[0] Message Index

Go to full version