Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Class - Adding Header Code Dynamically
Message
From
05/05/2003 16:08:15
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
 
 
To
05/05/2003 11:05:36
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00784946
Message ID:
00785099
Views:
17
Spyros

I found this solution from (I think) Andy Kramek. I designed my data handling classes with a property for handling grids "lgridclass". If lgridclass is .t. then I append "grd_" to the cursor name when I retrieve the data then I select the cursor the grid is bound to and zap the data and append from grd_cursor. That way the grid never looses the record source. I have found this also helps with list boxes as well.


>Hello Experts,
>
>We are working with Sql Server 2000 And Visual FoxPro 7.
>
>We have many forms that use private data sessions. In all the forms we have Grids. Grid Data is taken using SQL Pass Through, and Remote Views. There are forms that use data from the same tables or views. E.g Categories Form (using Category View) , Items Form (using Category View, Items data taken from SPT into a local cursor).
>
>As I told you before each form is using it's own Private Data Session, so there are no problems using data belonging to other forms.
>
>The problem we are facing are the Grids. Some Grids are loosing columncount and/or record source. Following a series of articles we are using a Grid reconstruction method to save grid information before getting new data for the grid, and a grid reconstruction method to restore data. Although this method works when we are switching between datasessions (changing form) sometimes the ColumnCount/RecordSource for some Grids is lost.
>
>Therefore as stated by various articles of the forum the way to eliminate the problem is to create a class grid for every grid and remove it,refresh data,add it to the form again.
>
>The problem is that we have forms with 6-7 grids, therefore we must create a class for each grid. This will result in having a lot of grids. As the project grows larger the number of grid Class will be very difficult to handle. We estimate that we are going to need more than 200 Grids in a class.
>
>
>Is there a better way to handle it?
>
>One way we are invistigating is to dynamically create a class using code. The problem is that we need to have some custom code on Grid.Headerxxx click/dblclk
>
>Can anyone provide any help on this?
>
>Thanks in advance,
>
>Spyros Christodoulou
>
>Following is a part of the Dynamic Grid Creation:
>Header1.Click procedure is not working.
>
>oform = CREATEOBJECT('FORM')
>oform.left = 0
>oform.top = 0
>oform.height = 500
>oform.width=500
>oTempObj = CREATEOBJECT('testgrid')
>oform.visible = .t.
>oform.addobject('testgrid1','testgrid')
>oform.testgrid1.visible = .t.
>DEFINE CLASS testgrid as Grid
> && Create Command button
> Columncount = 2
> recordsource="items"
> Column1.ControlSource = "items.itemid"
> Column2.ControlSource = "items.catid"
>
> Left = 0
> Top = 10
> Height = 225
> Width = 300
>
> PROCEDURE Init
> this.Column1.Header1.caption = 'Item ID'
> this.Column1.Header1.caption = 'Category ID'
> ENDPROC
>
> PROCEDURE header1.click
> ** Custom Code Here
> ENDPROC
>ENDDEFINE
Previous
Reply
Map
View

Click here to load this message in the networking platform