Recent

Author Topic: RXDbGrid not let me edit integer field or column  (Read 449 times)

eldonfsr

  • Sr. Member
  • ****
  • Posts: 447
RXDbGrid not let me edit integer field or column
« on: February 04, 2023, 01:59:05 am »
Hi some body has better ide what going on i create a dbgrid and setting everything but don't let me edit integer f=columns , can edit dates ot boolean colums but on columns with integer value on field don't let me edit  supoust going on edit mode and start to typing and change ... and don't take what i typed..


I using lazarus 2.2.4 on windows 10

eldonfsr

  • Sr. Member
  • ****
  • Posts: 447
Re: RXDbGrid not let me edit integer field or column
« Reply #1 on: February 05, 2023, 07:46:21 pm »
I Fixed was my mistake a few time i use direct dataset working with table, because i have serach option on the grid so when type anything goin to search option so all position change and los focus of grid, what i did on search event validate state of dataset...

Code: Pascal  [Select][+][-]
  1. procedure TFormUndMinStk.RxDBGPordUsKeyPress(Sender: TObject; var Key: char);
  2. Var ColName:String;
  3. begin
  4.  ColName:=RxDBGPordUs.Columns.Items[RxDBGPordUs.SelectedIndex].FieldName;
  5.  if( RxDBGPordUs.DataSource.DataSet.State = DsBrowse) then begin
  6.    if( (key >=#40) and (key <=#125)) then begin
  7.      search +=key;
  8.        with RxDBGPordUs do begin
  9.             RxDBGPordUs.DataSource.DataSet.Locate(ColName,search,[loCaseInsensitive,LoPartialKey]);
  10.        end;
  11.      key:=#0;
  12.    end;
  13.    if (key=#27) then  begin
  14.      search :='';
  15.      with RxDBGPordUs do begin
  16.        RXDBGPordUs.DataSource.DataSet.Locate(ColName,search,[loCaseInsensitive,LoPartialKey]);
  17.      end;
  18.  
  19.    end;
  20.  
  21.  end;
  22. end;
  23.  
  24.  

 

TinyPortal © 2005-2018