1. Is there a way to do create a Column at runtime?
2. How can I set the Background Color of a Cell?
Create a Column at Runtime
Started by Pit, Feb 14 2005 07:47 PM
5 replies to this topic
#1
Posted 14 February 2005 - 07:47 PM
#2
Posted 14 February 2005 - 07:59 PM
hi there,
there are some articles about handling GridView on the Berg Site.
1.
GridView1.Columns.Add(TTextualColumn);
http://www.bergsoft....ridhowto#addcol
2.
GridView1.Cell[Col,Row].Color := clGreen;
there are some articles about handling GridView on the Berg Site.
1.
GridView1.Columns.Add(TTextualColumn);
http://www.bergsoft....ridhowto#addcol
2.
GridView1.Cell[Col,Row].Color := clGreen;
#3
Posted 14 February 2005 - 08:58 PM
QUOTE (MasterEvil)
hi there,
there are some articles about handling GridView on the Berg Site.
1.
GridView1.Columns.Add(TTextualColumn);
http://www.bergsoft....ridhowto#addcol
there are some articles about handling GridView on the Berg Site.
1.
GridView1.Columns.Add(TTextualColumn);
http://www.bergsoft....ridhowto#addcol
I am trying this but always run into an EAccessViolation. I tried "Insert" as well, but this does not work, too.
I am using Version 2.9 - any ideas?
#4
Posted 14 February 2005 - 09:04 PM
QUOTE (NoSi)
I am trying this but always run into an EAccessViolation. I tried "Insert" as well, but this does not work, too.
:oops: I "Destroyed" the columns to clear the whole grid and tried to add then. Seems to be the reason. Thought, this would be the fastest way... .
#5
Posted 14 February 2005 - 10:21 PM
Hi,
If you still have some problems, you can post specific code here for your problem
regards
If you still have some problems, you can post specific code here for your problem
regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#6
Posted 15 February 2005 - 10:51 AM
I solved my challenge but I am not shure, if I match best the oportunities, given with GridView:
I have to create different tables in a form, depending on the choice made in a pulldown. The columns do not corresponded anyway, so I have to
[list]
[*]delete the existing rows / columns
[*]create a new coloumn set
[*]fill the new contents
[*]optimize coloumn width
[list]
Here the code I use. It works fine, but maybe, there is a better solution. Because I am still trying to understand the several tools of "the suite", I am looking for "best match", to use the components most effective:
Note: "ergebnis" => GridView
"Clearing" the Grid:
Creating one of the possible sets:
Rezising coloumns to best fit:
All improvements welcome
I have to create different tables in a form, depending on the choice made in a pulldown. The columns do not corresponded anyway, so I have to
[list]
[*]delete the existing rows / columns
[*]create a new coloumn set
[*]fill the new contents
[*]optimize coloumn width
[list]
Here the code I use. It works fine, but maybe, there is a better solution. Because I am still trying to understand the several tools of "the suite", I am looking for "best match", to use the components most effective:
Note: "ergebnis" => GridView
"Clearing" the Grid:
CODE
for i := Ergebnis.Columns.Count - 1 DownTo 0 Do
Ergebnis.Columns.Delete(i);
Ergebnis.Columns.Delete(i);
Creating one of the possible sets:
CODE
for i := 0 to 5 do
Ergebnis.Columns.Add(TTextualColumn);
for I := 6 to 7 do
Begin
Ergebnis.Columns.Add(TDateColumn);
Ergebnis.Columns[i].Alignment := taCenter;
End;
FillGrid; // Putting Data into the Grid
Ergebnis.Columns.Add(TTextualColumn);
for I := 6 to 7 do
Begin
Ergebnis.Columns.Add(TDateColumn);
Ergebnis.Columns[i].Alignment := taCenter;
End;
FillGrid; // Putting Data into the Grid
Rezising coloumns to best fit:
CODE
for i := 0 to Ergebnis.Columns.Count - 1 do
Begin
Ergebnis.FitToLargest(Ergebnis.Columns[i]);
// Make shure, that the columns are not to small for the sorting arrow:
If Ergebnis.Columns[i].Width < 100 then Ergebnis.Columns[i].Width := 100;
End;
Begin
Ergebnis.FitToLargest(Ergebnis.Columns[i]);
// Make shure, that the columns are not to small for the sorting arrow:
If Ergebnis.Columns[i].Width < 100 then Ergebnis.Columns[i].Width := 100;
End;
All improvements welcome
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users