Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Child grids
Message
De
25/05/1998 11:28:35
 
 
À
24/05/1998 23:46:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00101592
Message ID:
00101684
Vues:
21
>I have a form with a pageframe. On several of the pages there is a grid contain "children" of the master file. There is a form based "Next" and "Prior" method which allows the master file record to be changed and refreshes the page.
>Let's say I go to a record for which there are several "children". They show up in the grid, no problems and the first record in the grid is highlighted (I do a grid.setfocus in the page's activate). I click "Next" and the grid clears because there are no child records in the next master record. That's fine. I then do a "Prior" and while the three records do show again, none of them is "selected" or highlighted in the grid - but in fact nothing has the focus at this point. If I then press the TAB key the three records disappear from the grid and I'm lost ! :-)
>While Icould do a grid.setfocus in the next/prior etc methods, I rather find out why this strange behavoiur happens, because grids are driving me crazy :-)

The VFP highlighting is supposed to happen when a control in the grid has focus. When you click a button on your form that advances the record pointer, focus is moved to that button. If you want it to automatically go back to the grid, you will have to tell it to do so. There are other ways to achive row highlighting in a grid using dynamic column properties, (David Frankenbach even uses a shape control over the grid), if you are interested in these, then let me know. But even the dynamic properties method requires that the grid.afterrowcolchange event fires, and this is usually done by setting focus to the grid. In my nav/edit buttons that deal with tables whose records are represented in a grid, I usually do something like this:

DELETE
SKIP
thisform.grid1.refresh()
thisform.grid1.setfocus()

This is so the dynamic properties update themselves, and the grid knows which record to point at.


As for why your records disappear when you hit the tab key, I can't answer that one, but I would start with finding out which control has focus when this happens, and tracing with the debugger to see if any code is running that you are overlooking.

One other note for using one-to-many grids on the pages of a pageframe...
grids often 'forget' their datasource after the page has become active and then inactive. Often you must remind it by resetyting the grid's recordsource in the activate method of the page:

this.grid1.recordsource = 'lvcustomer'
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform