Vfp Grid Control 
Author Message
 Vfp Grid Control

Hi,

I have an application using vfp grid control to display information about
game.dbf, this game.dbf has 25 fields in it but i only want to show 3. Each
field under (thisform.grid1.column1.text1.dblclick() event) you are able to
double click on it and it display more information about the selected
fields.  All these are working fine when i first run it, except when i do
the following:

*I disconnect game.dbf from the grid so I can restore game.dbf to previous
readings
if used('Game')
    select game
    use
endif

*So i restore game.dbf

if !used('Game')
    use 'Game.dbf' in 0
   select game
endif

*Rebind the grid
thisform..grid1.RecordSource = 'Game'

*Set up grid details
thisform.pageframe1.page2.grid1.ColumnCount = 3

*Rebind the grid
thisform.grid1.column1.Header1.Caption = ' Mem #'
thisform.grid1.column1.ControlSource = 'game.memno'

thisform.column2.Header1.Caption = ' Machine #'
thisform.grid1.column2.ControlSource = 'game.machno'

thisform.grid1.column3.Header1.Caption = ' Credit Value'
thisform.grid1.column3.ControlSource = 'game.creditvalu'

WITH thisform.grid1
 .Column1.Width = 53
 .Column2.Width = 72
 .Column3.Width = 90
ENDWITH

thisform.grid1.Refresh
thisform.Refresh

Again it works fine but when i try to do a double on a field it not display
any information. Is there a better to way to working with vfp grid without
going through like i done above.

Please help.  Many thanks

Thi



Sun, 28 Aug 2005 09:48:31 GMT  
 Vfp Grid Control
Hi, Thi!
You wrote  on Wed, 12 Mar 2003 14:48:31 +1300:

[Sorry, skipped]

 T> Again it works fine but when i try to do a double on a field it not
 T> display any information. Is there a better to way to working with vfp
 T> grid without going through like i done above.

It is well-known Grid reconstructing behaviuor. You have to reset
Grid.RecordSource (say assign "" to it) before manipulating underlying table
(reopen/pack it). And reset RecordSource and ControlSources back
afterwards...

WBR, Igor



Sun, 28 Aug 2005 20:12:36 GMT  
 Vfp Grid Control
Hi Thi,

Igor is right; this probably is an issue best handled by resetting the
RecordSource property back to itself.  Take a look at this article that
describes a similar situation:

131836 PRB: Grid Not Refreshing Displaying a Cursor From Query
http://support.microsoft.com/?id=131836

Since you are only using three fields from the table, you may still need to
reset the column properties.

I hope this helps.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

Quote:
>Hi, Thi!
>You wrote  on Wed, 12 Mar 2003 14:48:31 +1300:
>[Sorry, skipped]
> T> Again it works fine but when i try to do a double on a field it not
> T> display any information. Is there a better to way to working with vfp
> T> grid without going through like i done above.
>It is well-known Grid reconstructing behaviuor. You have to reset
>Grid.RecordSource (say assign "" to it) before manipulating underlying
table
>(reopen/pack it). And reset RecordSource and ControlSources back
>afterwards...
>WBR, Igor



Sun, 28 Aug 2005 23:10:25 GMT  
 Vfp Grid Control
The problem here is you're pulling the rug out from under the grid. When you
close a grid's recordsource, all of its contained controls (and therefore
all your method code) is released.

You should be using a view for this. If you make it a parameterized view,
you can REQUERY() it without closing it and your grid won't deconstruct.

Dan


Quote:
> Hi,

> I have an application using vfp grid control to display information about
> game.dbf, this game.dbf has 25 fields in it but i only want to show 3.
Each
> field under (thisform.grid1.column1.text1.dblclick() event) you are able
to
> double click on it and it display more information about the selected
> fields.  All these are working fine when i first run it, except when i do
> the following:

> *I disconnect game.dbf from the grid so I can restore game.dbf to previous
> readings
> if used('Game')
>     select game
>     use
> endif

> *So i restore game.dbf

> if !used('Game')
>     use 'Game.dbf' in 0
>    select game
> endif

> *Rebind the grid
> thisform..grid1.RecordSource = 'Game'

> *Set up grid details
> thisform.pageframe1.page2.grid1.ColumnCount = 3

> *Rebind the grid
> thisform.grid1.column1.Header1.Caption = ' Mem #'
> thisform.grid1.column1.ControlSource = 'game.memno'

> thisform.column2.Header1.Caption = ' Machine #'
> thisform.grid1.column2.ControlSource = 'game.machno'

> thisform.grid1.column3.Header1.Caption = ' Credit Value'
> thisform.grid1.column3.ControlSource = 'game.creditvalu'

> WITH thisform.grid1
>  .Column1.Width = 53
>  .Column2.Width = 72
>  .Column3.Width = 90
> ENDWITH

> thisform.grid1.Refresh
> thisform.Refresh

> Again it works fine but when i try to do a double on a field it not
display
> any information. Is there a better to way to working with vfp grid without
> going through like i done above.

> Please help.  Many thanks

> Thi



Mon, 29 Aug 2005 00:55:42 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. VFP: Grid controls - Click, DblClick events

2. VFP: Grid Control Help

3. VFP : Grid Control Help

4. MS Data Grid Control 6.0 (OLE DB) and MS ADO Data Control 6.0

5. VFP 5 grid control

6. question on grid controls (VFP 6)

7. VFP 3.0 Grid control-making current record first

8. VFP 3.0 Grid Control Unbound

9. VFP 5.0 Grid Control Improvement Question

10. Grid Control in Codebook for VFP

11. VFP 6.0+SP3 / grid control and cursors ?

12. VFP6 Printing a grid (not grid control)

 

 
Powered by phpBB® Forum Software