Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Header caption
Message
From
23/06/2001 07:05:04
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/06/2001 05:48:00
Stephanie Caragos
Ebs Accounting Software Solutions
Cagayan de Oro City, Philippines
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00522742
Message ID:
00522744
Views:
8
>Hi friends....i have a little err...situation here. I'm trying to add columns to a grid at run time but i can't seem to add the caption. I used the following lines
>
>** where grd_expense is the name of the grid
>** hoo = is the variable containing the name of the column to be added
>
>thisform.grd_expense.AddObject(hoo, "column")
>thisform.grd_expense.&hoo..header1.caption='Amount'
>
>the problem that comes up is that the header caption does not display at all even if i refresh the grid. Also everytime i check if the caption does have value using messagebox ex.
>
>messagebox(thisform.grd_expense.&hoo..header1.caption)
>
>it indicates that the value of the caption is indeed the word 'Amount'
>
>how do i go about this problem?
>
>Stephanie

Stepanie,
Here it was visible = .t. not set after addobject() (addobject by default sets visibility to .f. to prevent weird visual effects while you change properties). Though with grid you don't need to set visible=.t. for all objects added do it to be sure.

Instead of Addobject, AddColumn is more suitable for grids. You can specify position ;) Here is a sample to show its flexibility :
with thisform.grd_expense
 .AddColumn(5) && You want its columnorder as 5   
 with .Columns(.ColumnCount) && Column index is constant despite columnorder
    .Name = hoo
    .Header1.Caption = 'Amount'
    * Other stuff is for free :)
    .ControlSource = lcControlSource
    .DynamicBackColor = 'iif(myTable.Amount<50,rgb(255,0,0),rgb(0,255,0))'
    .Width = .Width * 2 && Make it twice of default 75 or calculate to autofit
    .Addobject('spnAmount','Spinner')
    .CurrentControl = 'spnAmount'
    .spnAmount.Visible = .t.
 endwith
endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform