Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid does not refresh after adding empty row
Message
De
02/03/2003 08:32:05
 
 
À
08/02/2003 02:55:08
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00743140
Message ID:
00760103
Vues:
13
>>>>I found that adding this line loses current row in grid:
>>>>first row becomes current row always.
>>>>I added the recno() save and restore:
>>>>
>>>>
>>>>nr = RECNO()
>>>>with thisform.GridBase1
>>>> .RecordSource = .RecordSource
>>>> .setfocus()
>>>>endwith
>>>>BROWSE TITLE TRANSFORM(nr) FIELDS rno=RECNO()
>>>>GO (nr)
>>>>
>>>>
>>>>I got an error "Record is out of range" in the
>>>>GO (nr) line.
>>>>
>>>>BROWSE command shows -1 in title and also shows that a record having recno() -1 exists.
>>>>
>>>>Any ideas why GO (nr) fails ?
>>>
>>>As Fred said it sounds like you're not getting recno() of intended alias.
>>
>>Cetin,
>>
>>I tried the following code:
>>
>>
>>LOCAL nRecno
>>nRecno  = RECNO('mitteakt')
>>WITH _screen.Activeform.gridbase1
>>  * this causes a row to appear in grid:
>>  .recordsource = .recordsource
>>ENDWITH
>>SELECT mitteakt
>>
>>* this works but I caanot use this since tables are large and
>>* this takes a lot of time :
>>LOCATE FOR RECNO()=-1
>>
>>* This causes error record is out of range !
>>GO (m.nRecno) in mitteakt
>>
>>
>>Why the GO (m.nRecno) in mitteakt fails ?
>>
>>How to replace this LOCATE command with faster command in large tables without indexes ?
>
>Andrus,
>Your code as I remember was some wizard code very hard to follow.
>Why would you try to go recno() you're already on. Possibly in your code there is something causing a commit and making recno() positive (row buffered and rec pointer move causing implicit update ?). If -1 is nonexistant then all is committed. Try :
>go reccount('mitteakt') in 'mitteakt'
>
>Also possibly locate for recno()=-1 is actually failing and going to eof(). Grid gets you back to last record.

Cetin, I tried those suggestions without success.
Now I created a simple repro in message #760102 for you which
I hope is easier to follow.

How to refresh grid without losing all control sources and column settings ?
Andrus
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform