Stringgrid header and columns

1) How to set text in a column header?

2) My grid has five columns. When I run the program, five columns are shown, but the 
fifth one is blank.

{code}
grid1.AddObject(TStringColumn.Create(self));
grid1.AddObject(TStringColumn.Create(self));
grid1.AddObject(TStringColumn.Create(self));
grid1.AddObject(TStringColumn.Create(self));

//grid1.Columns[0].Width := 0;
grid1.Cells[0,0] := 'Rec ID';
grid1.Cells[1,0] := 'Application';
grid1.Cells[2,0] := 'User ID';
grid1.Cells[3,0] := 'Password';
grid1.Cells[4,0] := 'Comment';

Thanks, Mike
0
Mike
10/1/2011 10:34:21 PM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

5 Replies
8170 Views

Similar Articles

[PageSpeed] 41

There's a THeader component (in the grid palette) to which it appears you add THeaderItem sub-components at design time.

But if you actually want to use Row 0, you can still add TGridColums at design time.  I did that and was able to add pseudo-headers without a problem.
0
Ian
10/2/2011 10:38:45 AM
On 10/2/2011 6:38 AM, Ian Trackman wrote:
> There's a THeader component (in the grid palette) to which it appears you add THeaderItem sub-components at design time.

It won't go outside the grid, so it can't be placed above the columns, but will cover 
a row. Also, AFAICS, you can't use it to resize the columns

There is a ShowHeader grid property that displays/hides a gradient bar. It is 
segmented to match the column width, and the cols can be resized with it.
>
> But if you actually want to use Row 0, you can still add TGridColums at design time.  I did that and was able to add pseudo-headers without a problem.

Row 0 is the first row, why would I not use it? How did you implement it so it 
matched the grid?

Any thoughts why the text 'Comments' doesn't appear?

This grid is certainly.......... different.
0
Mike
10/2/2011 12:08:52 PM
On 10/2/2011 8:08 AM, Mike Reublin wrote:
> This grid is certainly.......... different.

Maybe there's a reason it isn't on the component demo. . . . <BG>
0
Mike
10/2/2011 1:21:12 PM
Ian Trackman wrote:

> There's a THeader component (in the grid palette) to which it appears
> you add THeaderItem sub-components at design time.
> 
> But if you actually want to use Row 0, you can still add TGridColums
> at design time.  I did that and was able to add pseudo-headers
> without a problem.

My test TStringGrid has 3 columns and 4 rows .. and includes a header.

I have no problem adding/changing the text in my right-most cell[2,0]
as follows:
	StringGrid1.Cells[2,0] := 'Test';
but that is not in the header, it is the top row of the body.

To add/change the text in my header's right-most column, I am using:
	StringColumn3.Header := 'Col 3'; 

Malcolm
0
Malcolm
10/2/2011 2:28:02 PM
On 10/2/2011 10:28 AM, Malcolm Taylor wrote:
> Ian Trackman wrote:
>
>> There's a THeader component (in the grid palette) to which it appears
>> you add THeaderItem sub-components at design time.
>>
>> But if you actually want to use Row 0, you can still add TGridColums
>> at design time.  I did that and was able to add pseudo-headers
>> without a problem.
>
> My test TStringGrid has 3 columns and 4 rows .. and includes a header.
>
> I have no problem adding/changing the text in my right-most cell[2,0]
> as follows:
> 	StringGrid1.Cells[2,0] := 'Test';
> but that is not in the header, it is the top row of the body.

I wasn't adding enough columns. I was looking at the part of the "undergrid" that was 
showing to the right of the cols I had added.
>
> To add/change the text in my header's right-most column, I am using:
> 	StringColumn3.Header := 'Col 3';

YES! grid1.Columns[0].Header := 'Rec ID';
>
> Malcolm

Thanks, Malcolm
0
Mike
10/2/2011 3:14:17 PM
Reply:

Similar Artilces:

How I can get the column header name when i clicked on the concerned column header
Hi All I had a problem in getting the columnheader name . I had tried with dw.getcolumnname but not successfull . I was in very big dilema where to write the code(i mean what 'event') . Suppose i had a fullname as my columnheader then i should able to get the fullname when i click on that column. thanks vasu Vasu: You will want to code this in the clicked event. You can look at GetBandatPointer() and GetObjectatPointer() functions in help. HTH, Austin "vasu" <vasu@i-vantage.com> wrote in message news:UfS3lsO2CHA.345@forums.sybase.com... ...

FireMonkey components
Hi, we are trying to upgrade this program to FireMonkey here http://www.arduino.com.au/Simulator-for-Arduino.html We have run into a few roadblocks, and it would be good to get some help on this: * ListBox does not seem to have a font property * StringGrid does not have a Column property * The TRegistry component does not recognise // myReg.RootKey := HKEY_LOCAL_MACHINE; * The Toolbar component does not allow new toolbuttons to be added Any help is much appreciated. Thanks. > Hi, we are trying to upgrade this program to FireMonkey here > http://www.arduino.com.au/Simulator...

Delphi 2010
Hi With new Delphi 2010 code i can't have a Dbgrid with ColumnClick event and column header Themed. i have see a new option in dbgrid : dgTitleClick :( if i active this property i lost themed blue rettangule when i move mouse over the column header ( it is like a very old dbgrid ) i'm using ThemedDBGrid unit , but don't work more in D2010 ( column header not Themed with OnTitleClick Assigned and dgTitleClick set to True ) How i can active ALL FEATURES of THEMED with OnTitleClick Assigned ? Edited by: Mauro Botta on Oct 13, 2009 11:54 AM upppp...

Detecting column header click on FireMonkey TStringGrid [Edit]
I have a FireMonkey TStringGrid on a form that is bound to a TClientDataSet using LiveBinding. I'd like to order the grid by a specified column by allowing the user to click on the column header and then manually updating the dataset in code. However, I've yet to figure out how to detect a column click. Does anybody know how to detect when a specific column header has been clicked on the TStringGrid? Does the TStringGrid automatically support this feature and I'm missing something? Thank you. > {quote:title=Joe Blow wrote:}{quote} > I have a FireMonkey TStringGrid on...

Getting the column number when clicking on a column header
How can I get the column number when I click on a column header in a grid/tabular datawindow? I need the column number because I want to sort the column Ascending/Descending when clicking on the header. (I cannot presume that the column header has the name xxx_t!) -- Tone Hansen ADB systermer ASA e-mail: th@adbsys.no Tone Hansen wrote in message <01bcda30$3f804eb0$a75d13c2@ws_pro_th>... >How can I get the column number when I click on a column header in a >grid/tabular datawindow? > >I need the column number because I want to sort the column >Ascending/...

Combining Newspaper columns with 1 columns header ??
Hi I have a DW with dynamically inserted data.. I have made i a 4 columns Newspaper, and it works like a charm. But one anoying thing is that the header and footer is also shown 4 times.. Isn't it possible to make the header and footer in one column and the rest in 4... I'd really like to NOT use a sub-DW because of the dynamically inserted data.. We use it together with 30 others tha do not have a Sub.. and therefore it won't work without changing the code for the new DW + sub-DW too.. -- Kind Regards Dennis Bostr�m Systemudvikler Bil-Info A/S Dennis@bilinf...

alignment of detail in each column did not match with column header.
I used code list bellow to export cr to excel. The problem is the alignment of detail in each column did not match with column header. In report design view, they are all match. Is there any way to fix it? ..... ExpOptions.ExportFormatType = ExportFormatType.Excel ExpOptions.FormatOptions = New ExcelFormatOptions Dim req As New ExportRequestContext req.ExportInfo = ExpOptions 'Dim s As Stream 's = Rpt.FormatEngine.ExportToStream(req) Dim strExportFile, strFileId As String strFileId = HttpContext.Current.S...

how to put column values as column headers in datagrid
Hi, I am trying to develop a report. Basically we have two tables named A and B. In Table A we have columns DelivTypeId EstDate CompDate In Table B we have columns DelivTypeId DelivDesc I have written a join select statement to get the DelivDesc, StartDate, Enddate so the result would be like DelivDesc StartDate EndDate Tiering1 8/31/2004 9/20/2004 Tiering2 8/31/2004 9/20/2004 Tiering3 8/31/2004 9/20/2004 Tiering4 8/31/2004 9/20/2004 I need my datag...

column header to span two columns in a datagrid display
Is it possible for a column header to span two columns? If so how would this be done? Thanks In the ItemDataBound (or ItemCreated) check if Item is of type Header and if so - define the colspan property of the Cell object which you want to define the Colspan for and delete the next Cell from hte DataGridItem CheersBug [MCSD] Is it possible to span header column in design view only. using some kind of CSS. I'm using ASP,NET 3.5 and GridView...

how to hide column data but keep column header text
 Hello,i want to hide my column data programmatically (C#) but still keep the column and its header.Like if i have a column with header "Title". All the data in this column must not be visible.any suggestion? Thank you  If it is all the data in a given column, then one way of doing it, would be to change: SELECT A, B, C, TITLE FROM TABLEtoSELECT A, B, C, TITLE, '' AS TITLE2 FROM TABLE Duplicate the Title column and change the data that is displayed in the second to TITLE2. For those that are allowed to see the data, show the first, for those tha...

Reference gridview column index using column headers
 Greetings,I have several GridViews all showing different collections of similar product data.  Due to changes in codes used to distinguish properties such as color and size, I'm having to write several rules into the row databound events.  The issue I'm having is that the group who will be using the application haven't finalized the order of the columns, so everytime I reorder the columns, I have to changes all the column indexes in my code behind so that the rules are being applied to the right columns. I'd like to know if there is a way to reference the colu...

Datagrid: Add a Main header row, above the column headers
Is this possible?  How is this done? -smc~ Remember To Mark The Posts Which Helped You As The ANSWER ~ Yes...Handle the ItemCreated event.  I have a sample using the GridView that can give you the idea http://www.webswapp.com/codesamples/aspnet20/nestedgridviews/default.aspxHTH,Phillip Williams,http://www.webswapp.com Do you have any examples using DataGrid in VB? Can the Header be displayed above the column headers?  -smc~ Remember To Mark The Posts Which Helped You As The ANSWER ~ http://www.societopia.net/samples/dataGrid_customheader.aspxHTH,Phillip Williams,http:...

Ajax Gridview drag column header to reorder column
I want to dynamically(Client side) reorder column of my gridview  by drag that column on desired positionand at the same time column like check box temp let column at fix position on the first columnPlease help.....   Thanks in advance  Hi, You got any solutions for this, i do have the same requirement for column sequecing on client side for my asp.net gridview. Please share the same if you have any solutions.  Thanks, Mohan D...

superreview granted: [Bug 356860] Custom columns from message headers : [Attachment 248409] make list of headers be space delimited since ', ' is apparently a legal char in a header
Scott MacGregor <mscott@mozilla.org> has granted David Bienvenu <bienvenu@nventure.com>'s request for superreview: Bug 356860: Custom columns from message headers https://bugzilla.mozilla.org/show_bug.cgi?id=356860 Attachment 248409: make list of headers be space delimited since ',' is apparently a legal char in a header https://bugzilla.mozilla.org/attachment.cgi?id=248409&action=edit ------- Additional Comments from Scott MacGregor <mscott@mozilla.org> is there documentation devmo that might need updated to reflect this change? ...

superreview requested: [Bug 356860] Custom columns from message headers : [Attachment 248409] make list of headers be space delimited since ', ' is apparently a legal char in a header
David Bienvenu <bienvenu@nventure.com> has asked Scott MacGregor <mscott@mozilla.org> for superreview: Bug 356860: Custom columns from message headers https://bugzilla.mozilla.org/show_bug.cgi?id=356860 Attachment 248409: make list of headers be space delimited since ',' is apparently a legal char in a header https://bugzilla.mozilla.org/attachment.cgi?id=248409&action=edit ...

StringGrid Column
When I click on column 3, I am trying to get the value of column 2. Currently I am doing it like this String tmpVar = StringGrid1->Cells[StringGridExercise->Col-1][StringGrid1->Row]; How come I can't hard code the column like String tmpVar = StringGrid1->Cells[StringGridExercise->Col[2]][StringGrid1->Row]; I know this is not the way to do it, how is it actually done? Thanks. > {quote:title=Steven Murphy wrote:}{quote} > When I click on column 3, I am trying to get the value of column 2. Currently I am doing it like this > > String tm...

When is a column not a column?
I have several extremely similar datawindows that I have to maintain that go against the same table. Recently, I had to add a column to that table, and also add the column to ALL of these datawindows that go against this table. I added the column to the first datawindow, set up the edit control style, etc. I then did a copy/paste of the columns edit control to the remaining dw's (of course remembering to first add the column in SQL). Everything (update props, column specs, column props) seems to indicate that the pasted column is linked to the column I selected, HOWEVER, when I...

Columns header...
We have an application developped with PB 7.0.1 (7015) under nt4 sp5. There are several states in the dws : query, add, modify. When a dw is entering in query mode, the columns that are not visible are displayed so that the user can enter criterias in any column. But there is a problem is some dws : the invisible cols do appear but some headers don't ! Here's the code of the function that display those invisible cols : -------------------------------------------------------------- .... ls_tmp = ldw_requestor.describe("DataWindow.Column.Count") If not IsNumb...

Sorting columns
Hi - I have a datagrid that is set to allow sorting and paging.  It works great.  What I would like to do now, for usability sake, is to dynamically change the background color of the column header the user is sorting by.  I will like to do this dynamically as part of the sorting function.For example: I have a datagrid with 3 columns with the headers "Company Name", "Production Name", and "Audition Dates".  By default the datagrid loads info sorted by the "Company Name" column.  I would like to dynamically set the background color of that header to red.  If the ...

How to know the Column number based on Column header in Grid View
Hi I have a gridview with 3 columns. Say : id, Name and skill. I want to know the column number of Column headers(May be Name,Skill or id)... Thanks Archan I don't think there is any inbuilt way to do it. You have to loop through and compare the header text and get the index. private int GetColumnIndex (string headerText) { int idx = 0; foreach (DataControlField gcf in GridView1.Columns) { if (gcf.HeaderText == headerText) { break; } idx++; } return idx; } Mark replies as answers if they helped you solve the problem. Hi siva Thanks for your ...

GridView : Freezing First Columns and Freezing Column's Headers
Hi Looking for code that freezes the first two columns and the column's headers in a GridView, so as to give a similar behavior and the appearance of Excel, but in Visual Web Developer, I've found a link that show a very efficient solution, but applies just to a DataGrid control in IE. I've found lots of additional information in the web, but I think the best aproach is this... http://web.tampabay.rr.com/bmerkey/examples/locked-column-csv.html http://www.codeproject.com/aspnet/FreezePaneDatagrid.asp Please, look at this alternative solution also... may be ...

Gridview scrolling with Fixed Header
Hi   I want to keep the Headers fixed and  scroll the GridView . I am using the following the code.  <HeaderStyle HorizontalAlign="Left" ForeColor="Black" CssClass="Freezing" BackColor="#E0E0E0" />.Freezing { position:relative ; top:auto; /* top:this.offsetParent.scrollTop-1; */ /* top:expression(this.Parent.scrollTop); */z-index: 10; }  It works fine for Bound columns . It does not work for Dropdown columns. when i scroll the grid Dropdown box hides the Header text. My code is below.  <div class="&...

data presenttion with dynamic header and columns also fliping rows/columns
 I have to data in data set in the form  CustomerName , dateof theWeek abc                    1 januaryabc1                    1 januaryxyz                     1 january dfg                       2 januaryhsg            &nb...

Want to start new header column 2 columns into first row
I want to add a new header to the first row of my gridview but i want to start 2 columns into the first row. I tried row.Cells.AddAt(2,Cell); but this gives me an error.so how can it be done?    Here is my code so far........     protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)    {        SortedList creatCels = new SortedList();        creatCels.Add("1", "Test,2,1");         GetMyMultiHeader1...

Web resources about - Stringgrid header and columns - embarcadero.delphi.firemonkey

Resources last updated: 2/16/2016 11:29:35 PM