bbm Posted June 6, 2019 Share Posted June 6, 2019 Hi, is there any way to use different editors in the same column of a dbgrid for different rows? Best regards Link to comment Share on other sites More sharing options...
csaszko Posted November 6, 2019 Share Posted November 6, 2019 Hi, Do you have any solution for this problem? I need to use different control in a same column (edit,combobox, datetimepticker) Or I have a solution for vcl dbgrid which is perfect for me, but not working with unidbgrid (or i dont know how to archieve it) my code for vcl procedure TForm128.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); if (gdFocused in State) then begin if (Column.Field.FieldName = 'variable') then begin if (ZQuery2.FieldByName('variable_type').AsString = 'text') then begin variable_datumpicker.Visible := false; variable_combobox.Visible := false; with variable_edit do begin Left := Rect.Left + DBGrid1.Left + 2; Top := Rect.Top + DBGrid1.Top + 2; Width := Column.Width; Height := Rect.Bottom - Rect.Top; variable_edit.Text := ZQuery2.FieldByName('variable_value').AsString; Visible := true; end; end; etc... please help me Thanks Link to comment Share on other sites More sharing options...
Sherzod Posted November 7, 2019 Share Posted November 7, 2019 6 hours ago, csaszko said: I need to use different control in a same column (edit,combobox, datetimepticker) Isn't it better to use an extra form for editing? Link to comment Share on other sites More sharing options...
csaszko Posted November 7, 2019 Share Posted November 7, 2019 3 hours ago, Sherzod said: Isn't it better to use an extra form for editing? Yes finally my solution was that what you mentioned. Aniway can i get somehow rect of the actual cell? Thanks Link to comment Share on other sites More sharing options...
Sherzod Posted November 7, 2019 Share Posted November 7, 2019 23 minutes ago, csaszko said: Aniway can i get somehow rect of the actual cell? Please explain. Link to comment Share on other sites More sharing options...
csaszko Posted November 7, 2019 Share Posted November 7, 2019 1 minute ago, Sherzod said: Please explain. I mean like in the vcl code : with variable_edit do begin Left := Rect.Left + DBGrid1.Left + 2; Top := Rect.Top + DBGrid1.Top + 2; Width := Column.Width; Height := Rect.Bottom - Rect.Top; << in this case I get the cell canvas rect and can my control cover acutal cell whole canvas. Like in unidbgrid editor when is showing of the given control you cover whole canvas of that cell, I tried to get editor's control(edit,combobox) left, top and with.. but didn't work for me, for example only got the original edit's witdh(as placed on form in design mode) , not what dbgrid is showing runtime. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now