Working with Picklist, How to make it read only lazarus / 31-LCL ---------------------------------------------------------------------- asdf · 2012-10-27 09:28 I need the values are limited to the ones contained in its list and cannot key in in that column. Code: [Select]StringGrid1.Columns[n].ButtonStyle:=cbspicklist; StringGrid1.Columns[n].PickList.CommaText:='Car,Bicycle,Truck,Train,Wa lk'; What should be wriiten next ? Thank you in advance ---------------------------------------------------------------------- fabienwang · 2012-10-27 20:12 Hey asdf. Add to your StringGrid the event OnValidateEntry and implement that: 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 TForm1.StringGrid1ValidateEntry(sender: TObject; aCol, aRow: Integer;  const OldValue: string; var NewValue: String);var  i: Integer;begin  if StringGrid1.Columns.Items[aCol - 1].PickList.Count <> 0 then  begin    if StringGrid1.Columns.Items[aCol - 1].PickList.IndexOf(NewValue) = -1 then    begin      showmessage('Value: ' + NewValue + ' is not in the list !');      NewValue := '';    end;  end;end; I hope it will fit your needs, just coded it in few mins ! (of course you can avoid the showmessage i just put it to test ) ---------------------------------------------------------------------- asdf · 2012-10-28 00:07 Hello FabienWang, Long Time No see  I tried codes from http://wiki.lazarus.freepascal.org/Grids_Reference_ Page#Example:_Working_with_Picklist.2C_How_to_make_it_read_only_and_Ho w_to_fill_it_at_run_time. And from your suggestion. But error, why ? ---------------------------------------------------------------------- fabienwang · 2012-10-28 13:28 humm, I guess just copy paste my code while in your StringGrid properties, the event onValidateEntry isn't bound to my method...