Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Sajan Jacob
  Where is Sajan Jacob?
 mumbai
 India
 Sajan Jacob
 To: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 Tags
Subject: RE: GRID INIT Event - update
Thread ID: 311074 Message ID: 311137 # Views: 30 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Wednesday, June 29, 2011 4:23:37 AM         
   


Dear All
The problem has identified and solved now. Thanks for the valuable info.
It was creating an object each time which cause the program was not running,
Thisform.grid1.column4.AddObject("ctrShape"+Transform(xx),"Container") 

Above line was creating the object each time calling the event. All the addobject actions is mentioned in the grid'sINIT event and remaining in the method ( gridupdate).
After these changes , program works fine.

Sajan Jacob


> > Hi Cetin
> >
> > I had tried the same command before also, then only i posted it here.
> > After clicking on the month combo, getting stuck up in following line
> >
> > For xx=0 To 200
> > 	Thisform.grid1.column4.AddObject("ctrShape"+Transform(xx),"Container") &&  stuck up on this line
> > 	jssobj=Evaluate("this.column4.ctrShape"+Transform(xx))
> > 	jssobj.Visible=.T.
> > 	jssobj.BackStyle=0
> > 	jssobj.BorderWidth = 0
> > 
> > 
> > ...
> > 

> >
> > Sajan
>
> Looking at your image plus this code, I wonder if you are doing something wrong. Why would you add 201 containers to a grid column. That doesn't sound right to me. To show something like percentage you simply need a single container and change its size. You don't need something like backstyle setting either. You can find a sample if you search for keywords "fake, dynamic, backstyle".
>
> Update: Found the code for you:
>
>
Public oForm
> oForm = Createobject('myForm')
> oForm.Show
> 
> Define Class myForm As Form
>   Add Object myGrid As Grid
> 
>   Procedure Load
>     Create Cursor myProcess (percent i, Name c(10))
>     Rand(-1)
>     For ix = 1 To 100
>       Insert Into myProcess Values (Int(Rand()*100),Sys(2015))
>     Endfor
>     Locate
>   Endproc
> 
>   Procedure Init
>     With This.myGrid
>       .AddColumn(.ColumnCount+1)
>       .Columns(.ColumnCount).ControlSource = 'myProcess.Percent'
>       .Columns(.ColumnCount).DynamicFontBold = "!(thisform.UpdateContainer(this.columns(1).myPercent))"
>       .Columns(.ColumnCount).Header1.Caption = 'Percentage'
>     Endwith
> 
>     With This.myGrid.Columns(1)
>       .AddObject('myPercent','myContainer')
>       .myPercent.Width = .Width
>       .myPercent.lblPercent.Width = .Width
>       .myPercent.Visible = .T.
>       .DynamicFontBold = "thisform.UpdateContainer(this.columns(1).myPercent)"
>       .CurrentControl = 'myPercent'
>       .Sparse = .F.
>     Endwith
> 
>     This.myGrid.Columns(1).Enabled = .F.
>   Endproc
> 
>   Procedure UpdateContainer(toContainer)
>     With toContainer
>       .shpPercent.BackColor = Iif(percent>90,0xFF,Iif(percent>70,0x00FFFF,0x00FF00))
>       .shpPercent.Width = toContainer.Parent.Width * percent/100
>       .lblPercent.Caption = '%'+Ltrim(Str(percent))
>     Endwith
>   Endproc
> Enddefine
> 
> Define Class myContainer As Container
>   BackColor=0xFFFFFF
>   BorderWidth=0
>   Add Object shpPercent As Shape With BorderStyle = 0
>   Add Object lblPercent As Label With Alignment = 2 ,BackStyle=0
> Enddefine

>
> Cetin Basoz
>
> .Net has got better.Think about moving - check my blog:
> My Blog
> Blog (mirror) - sounds to be down

ENTIRE THREAD

GRID INIT Event - update Posted by Sajan Jacob @ 6/28/2011 4:20:17 PM
RE: GRID INIT Event - update Posted by Cetin Basoz @ 6/28/2011 4:48:50 PM
RE: GRID INIT Event - update Posted by Sajan Jacob @ 6/28/2011 5:02:06 PM
RE: GRID INIT Event - update Posted by Cetin Basoz @ 6/28/2011 11:09:35 PM
RE: GRID INIT Event - update Posted by Sajan Jacob @ 6/29/2011 4:23:37 AM
RE: GRID INIT Event - update Posted by Ilya Rabyy @ 6/28/2011 5:04:29 PM
RE: GRID INIT Event - update Posted by Cetin Basoz @ 6/28/2011 11:04:25 PM
RE: GRID INIT Event - update Posted by Samir H. @ 6/28/2011 7:07:21 PM
RE: GRID INIT Event - update Posted by Cetin Basoz @ 6/28/2011 11:10:17 PM
RE: GRID INIT Event - update Posted by Ilya Rabyy @ 6/28/2011 11:34:13 PM
RE: GRID INIT Event - update Posted by Cetin Basoz @ 6/29/2011 12:35:54 PM
RE: GRID INIT Event - update Posted by Samir H. @ 6/29/2011 4:17:16 AM
RE: GRID INIT Event - update Posted by Mike Gagnon @ 6/28/2011 11:57:13 PM
RE: GRID INIT Event - update Posted by Ilya Rabyy @ 6/29/2011 4:30:16 PM
RE: GRID INIT Event - update Posted by Samir H. @ 6/29/2011 6:01:39 PM
RE: GRID INIT Event - update Posted by Ilya Rabyy @ 6/28/2011 4:55:01 PM
RE: GRID INIT Event - update Posted by Sajan Jacob @ 6/28/2011 5:16:55 PM
RE: GRID INIT Event - update Posted by Ilya Rabyy @ 6/28/2011 6:12:43 PM
RE: GRID INIT Event - update Posted by Tamar Granor @ 6/28/2011 10:40:21 PM