Lazarus

Programming => Databases => Topic started by: daveinhull on December 02, 2018, 11:17:44 am

Title: Move to next column if entered column is read only
Post by: daveinhull on December 02, 2018, 11:17:44 am
Hi,

Could anyone point me in the right direction to work out how to move to the next column in a DBGrid if the entered column is read only.

Thanks
Dave
Title: Re: Move to next column if entered column is read only
Post by: sash on December 02, 2018, 09:32:50 pm
Something like that (not tested)
Code: Pascal  [Select][+][-]
  1. procedure TForm1.DBGrid1ColEnter(Sender : TObject);
  2. begin
  3.   with DBGrid1 do begin
  4.     if Assigned(SelectedColumn) and (not SelectedColumn.ReadOnly then
  5.       if SelectedColumn <> LastColumn then // handle (ignore) last column
  6.         SelectedIndex := SelectedIndex + 1;
  7.   end;
  8. end;

Upd: should you care (and will be next OnColEnter triggered) if next column is readonly too?
Title: Re: Move to next column if entered column is read only
Post by: daveinhull on December 28, 2018, 05:13:03 pm
Hi sash,

Sorry I missed your reply, many thanks

Dave
TinyPortal © 2005-2018