Topic: Locking Table lenghts in place
hey guys, is there a way to "lock" table sizes in place? i have to readjust everything after i restart the app
My Visual Database → General → Locking Table lenghts in place
hey guys, is there a way to "lock" table sizes in place? i have to readjust everything after i restart the app
Hello Vasco,
I usually set the desired size of my columns in the OnChange event of the Tablegrid, this way, each time new data are loaded in it, the size remain the same :
procedure vendors_TableGrid1_OnChange (Sender: string);
begin
vendors.TableGrid1.Columns[0].Width := 120;
vendors.TableGrid1.Columns[1].Width := 200;
vendors.TableGrid1.Columns[2].Width := 70;
vendors.TableGrid1.Columns[3].Width := 70;
end;
For text alignment in the columns or the headers of the columns you can do :
procedure Form1_TableGrid1_OnChange (Sender: string);
begin
Form1.TableGrid1.Columns[0].Alignment := taRightJustify; // first column
Form1.TableGrid1.Columns[1].Alignment := taCenter;
Form1.TableGrid1.Columns[2].Alignment := taLeftJustify;
Form1.TableGrid1.Columns[1].Header.Alignment := taCenter; //this is for the header text
end;
Hiding a column :
procedure Form1_TableGrid1_OnChange (Sender: string);
begin
Form1.TableGrid1.Columns[2].Visible := False;
end;
And accessing the value of the hidden column :
procedure Form1_TableGrid1_OnCellClick (Sender: string; ACol, ARow: Integer);
var
sValue: string;
begin
sValue := Form1.TableGrid1.Cells[2,ARow];
end;
Cheers
Mathias
Also you can disable to change columns size
procedure Form1_TableGrid1_OnChange (Sender: string);
begin
Form1.TableGrid1.Columns[0].Width := 120;
Form1.TableGrid1.Columns[0].Options := Form1.TableGrid1.Columns[0].Options + coFixedSize;
end;
oh boy oh boy, here i go programming again!
Thanks guys!
My Visual Database → General → Locking Table lenghts in place
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi