Prevent column moves in a DBGrid  

Send By: Radikal (Q3 Team)
Web : http://www.q3.nu
Email: radikal@q3.nu
Date: 26/12/99

Tip accessed 592 times

 



To impede that they move of place the columns in a DBGrid, simply put Options.dgColumnResice to FALSE
The problem is that we also impede that redimensionen the columns.

To impede that they move them, but leaving that they can them redimensionar, put this code in the event OnColumnMoved of your DBGrid:


 procedure TForm1.DBGrid1ColumnMoved(Sender: TObject; FromIndex,
   ToIndex: Integer);
 begin
   With (Sender as TDbGrid).Columns do
     Items[ToIndex].index:=Items[FromIndex].index;
 end;