Although I've done a lot of work with DBGrids I've not up until now ever had need to use a TStringGrid, and as much as they are alike I'm surprised at many of the differences...some of which have me a little baffled! For example, although one can set the columns up so that the user can alter their individual widths at runtime, I have not been able to find a way of storing this info back into an ini-file so that these settings can be retained and used again in future sessions. Is this possible? If so how, because the StrGrid.Col[0] doesn't have a width property...only a default width that sets all of them the same including the fixed column! Also, I was under the impression I could store a stringgrid with any string info it's cells contain, including that in it's fixed columns, to a text file and then load the stringgrid back up with that same info directly from the file. It seems the individual column text can be saved that way but not all in one file. How is this handled? Finally, Because this particular grid will be used by a restaurant manager to set her waitress's working hours, I need to be able to print a copy of the grid out in landscape format after she has made all the entries for a particular week. I don't want a print screen because that would show the entire form...just the grid itself. How can this best be accomplished?
>From "Robert Meek" Personal e-mail: [EMAIL PROTECTED] dba / "Tangentals Design" Visit us at: www.TangentalsDesign.com Home of "The Keep"!
Heres a bit of code that resizes a 6 column string grid when a form is resized: Column 0 is fixed at 20 Columns 2 -5 are 10% of the grid width each Column 1 is whatever's left.
x is set at width-47 to accommodate the scrollbar, you could have a little code to determine if you need to do this.
It is a simple matter to extract the column sizes to an ini file.
Procedure GridSize; Var x,y,z:real; begin x:=(frm_main.SG_Set.Width)-47; y:=(x/100)*10; z:=y*4; frm_main.SG_Set.ColWidths[0]:=20; frm_main.SG_Set.ColWidths[1]:=round(x-z); frm_main.SG_Set.ColWidths[2]:=round(y); frm_main.SG_Set.ColWidths[3]:=round(y); frm_main.SG_Set.ColWidths[4]:=round(y); frm_main.SG_Set.ColWidths[5]:=round(y); end;
here is a way to get a stringlist from a String Grid row: Frm_Main.Memo1.Lines.AddStrings(Frm_Main.SG_Set.Rows[Frm_Main.SG_Set.Row]);
Mr Chris Moore Systems Engineer
Brother Industries (UK) Limited Tel: +44(0) 1978 813 425 Fax: +44(0) 1978 813 495
_______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

