Lazarus

Programming => Databases => Topic started by: Bert_Plitt on March 20, 2015, 09:24:37 pm

Title: How can I use a DBGrid Pick List
Post by: Bert_Plitt 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.
Title: Re: How can I use a DBGrid Pick List
Post by: Mike.Cornflake 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 :-)
TinyPortal © 2005-2018