[Lazarus] Dropdown in stringgrid ?

Jesus Reyes A. jesusrmx at gmail.com
Tue Jun 9 06:41:58 CEST 2015


En Mon, 08 Jun 2015 06:03:28 -0500, Koenraad Lelong  
<lazarus2 at de-brouwerij.be> escribió:
>> So you want the picklist only in the first row. Then use something like:
>>
>> // use grid's OnSelectEditor
>> procedure TForm1.StringGrid1SelectEditor(Sender: TObject; aCol, aRow:
>> Integer;
>>    var Editor: TWinControl);
>> begin
>>    if aRow=StringGrid1.fixedRows then begin
>>      Editor := StringGrid1.EditorByStyle(cbsPickList);
>>      // fill the picklist with field list
>>      TPickListCellEditor(Editor).Items.CommaText :=
>> 'Field1,Field2,Field3,etc';
>>      // or TPickListCellEditor(Editor).Items.Assign(FieldList)
>>      // or etc
>>    end else
>>      Editor := nil; // readonly the rest of rows (or select another  
>> editor)
>> end;
> Hi,
>
> It's almost what I want. Your code makes the second row behave like a  
> picklist (1 fixed row : row #0 is fixed), so I subtracted 1 from  
> StringGrid1.fixedRows but no luck ;-)I tried a few things, but I can't  
> let the cells of the fixed row to behave like a picklist. Am I still  
> missing something ?
>
> Anyway, thanks very much already.
>

Can't you set FixedRows:=0?, if you do that what problems do you see in  
your program?

Jesus Reyes A.





More information about the Lazarus mailing list