[SOLVEDTValueListEditor: Struggling to capture the selection from the pick list. lazarus / 31-LCL ---------------------------------------------------------------------- EganSolo · 2021-02-14 07:32 I've used TValueListEditor.ItemProp[KeyName] to set the editing style to esPickList and to load the picklist with a bunch of values. The pick list behaves as expected. When I select a value from the list, it collapses and the value appears inside the cell of the TValueListEditor, but when I move the focus away from the cell, I lose the value. I could implement the SelectEditor event handler to assign a combo box as the editor for the cell, but I prefer specifying the pick list in the ItemProp. I've tried to implement OnEditingDone, but I got stumped since I can't seem to access the PickList to grab its selected item and assign it to the cell. Is there a straightforward solution to set the value of a picklist after it has been selected? Should I implement SelectEditor instead? ---------------------------------------------------------------------- EganSolo · 2021-02-14 08:36 I've made a bit of progress but my solution looks funky: I implemented OnValidateEntry. VLE stands for Value List Editor. Here's the code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Procedure TMyForm.VLE_ValidateEntry(sender: TObject; aCol, aRow: Integer; Const OldValue: string; Var NewValue: String);var aProperty : Tproperty;Begin  With VLE do  begin     aProperty := Objects[NameColIdx, Row] as TProperty;     If aProperty.FieldKind = fk_Choice     then Cells[aCol,aRow] := NewValue;  End;end;       TProperty is a class of my own and its instances are stored in the TValueListEditor.Objects[0,Row], that is, they are associated with the keys of the value list editor. If TProperty.FieldKind = fk_Choice then the cell holding the value of the row will be edited with a pick list. As you can see from the code, I'm assigning NewValue to the value list editor. It works, but this strikes me as odd because NewValue is a Var and I'm supposed to change it in case it's invalid. As it is, I'm shortcutting the process and assigning NewValue to the grid. Does this make sense? ---------------------------------------------------------------------- lucamar · 2021-02-14 17:09 He can't do that because it's an event handler, so he has to keep the signature as is. What makes no sense is that the OP needs it to set the cell: it should set itself with NewValue whether it changes or not, so the whole handler should be, in fact, superfluous. It's difficult to see why it isn't doing it without a more complete example. I made a very small test here (Laz/fp 2.0.10/3.2.0 Linux-gtk x86_64) and it worked without any fuss. ---------------------------------------------------------------------- EganSolo · 2021-02-14 17:20 Hi Lucamar, Could you please attach your code? Did you implement ValidateEntry or a different handler? Thanks! ---------------------------------------------------------------------- lucamar · 2021-02-14 17:39 Quote from: EganSolo on February 14, 2021, 06:20:01 pmCould you please attach your code? No, sorry. It was in the temp folder and has been overwritten with other tests QuoteDid you implement ValidateEntry or a different handler? It only used OnGetPickList to set the pick list; everything else worked as it should by default. It was just a very small, quick and simple test to see whether using picklists worked by default: a value list editor with three fields (one of them a pick list), the OnGetPickList handler and nothing more. ---------------------------------------------------------------------- EganSolo · 2021-02-14 18:07 Thanks for taking the time to try it out, Lucamar, I followed your direction and created a smaller test program and, you're right, it worked. I checked back into my main code and I realized I was under the assumption that I had to handle the selection from the picklist and save it into the cell manually. I guess I was simply overdoing it. Once I removed the extraneous code, it worked like a charm. Thanks!