Recent

Author Topic: How can I use a DBGrid Pick List  (Read 5903 times)

Bert_Plitt

  • Jr. Member
  • **
  • Posts: 62
How can I use a DBGrid Pick List
« on: March 20, 2015, 09:24:37 pm »
This newbie needs some help.  I have a DBgrid attached to a table with five fields.  I populate the Pick List of column 1 with this code:

    DBGrid1.Columns.Items[1].PickList.Clear;
    DBGrid1.Columns.Items[1].PickList.AddStrings(SList);

I am trying to implement the following behavior.  When the user selects an item from the Pick List to fill in the cell, I want to trigger a procedure to fill in the remaining cells in the row based on the selected value in column 1.  My problem is I cannot find any events in the Object Inspector that are tied to the Pick List.  I was looking for something like "OnSelect", "OnEditingDone", or "OnCloseUp". 

Is there a better way to implement the behavior I looking for?  Any help with example code will be greatly appreciated.
Windows 10, Lazarus 2.2.2, FPC 3.2.2

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: How can I use a DBGrid Pick List
« Reply #1 on: March 20, 2015, 10:04:59 pm »
Suspect you'll find what you're after on this page...
http://wiki.lazarus.freepascal.org/Grids_Reference_Page

I also remember seeing a decent grid demo that shipped with Lazarus (Projects - Close.  In the resulting dialog, click on Examples I think it is, then search for grid).

Finally, this question has been asked before.  Click on the search icon in the top right.  Type "grid picklist" and hit return.  There may be useful code in one of the other answers :-)
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

 

TinyPortal © 2005-2018