Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid empty after TableRevert(.f.)
Message
De
05/11/2001 04:59:43
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00576215
Message ID:
00577308
Vues:
23
Hi Vlad,

Thank your for your help so far, and sorry, I did not read your last message properly, you said "AfterRowColchange", I read "Before". Just goes to show that one sees what one expects to see.

But because I did not read properly, I actually got the thing to work in the BeforeRowColChange method (sort of).

If a new record is added it works, but if the user decides to empty a previously filled member and then moves away from the record, it only works in the debugger, not in real life.

Grid refresh does not have any effect any either, but KEYBOARD '{UPARROW}' does.

I'd appreciate it if you could have another look at this, even though I'm using a different approach from the one you suggested.
llEnabled=NOT EMPTY(THIS.Column1._TextBox1.VALUE) AND RECCOUNT(THIS.RECORDSOURCE)# 0
lnRecno=THIS._record	   && Access method

THISFORM.Navigationbar1.NewButton.ENABLED=llEnabled
THIS.PARENT.NewButton.ENABLED=llEnabled
THIS.ALLOWADDNEW=llEnabled

lnState=GETFLDSTATE("Member")
IF lnState # 1			&& Field has been changed
  DO CASE
    CASE EMPTY(THIS.Column1._TextBox1.VALUE)
        && Never mind if it's newly added, it must not be empty
        llRetval=TABLEREVERT(.F.,"ActiveMembers")
	IF EOF("ActiveMembers")
	   KEYBOARD '{UPARROW}'
	ENDIF

    CASE INDEXSEEK(ALLTRIM(THIS.Column1._TextBox1.VALUE),.F.,"Members","Member")
        && If it already exist´s in the base table
	llRetval=TABLEREVERT(.F.,"ActiveMembers")

    CASE SEEK(ALLTRIM(THIS.Column1._TextBox1.VALUE),"ActiveMembers","Member");
        AND RECNO("ActiveMembers") # lnRecno
        && or somewhere above this record in the view
	GO lnRecno IN ActiveMembers
	llRetval=TABLEREVERT(.F.,"ActiveMembers")
    ENDCASE
ENDIF
>Hi!
>
>You can use getfldstate(-1) and check if all characters there contain "3":
>
>if chrtran(getfldstate(-1),"3","")==""
>* this record is new but contains no data
>* tablerevert it:
>...
>endif
>
>So in AfterRowColChange you check if reccount() is changed (to see if new record added), if yes - store current record pointer and go to previous record, check previous record if it is completely empty or whatever and revert changes in it, then go back to new created record.
>
>As about "empty" grid - after all changes in the record source for grid you have to use "Grid.Refresh" method call to refresh grid after such changes. This include tablerevert() as well. Let me know if this helped...
>
Peter Pirker


Whosoever shall not fall by the sword or by famine, shall fall by pestilence, so why bother shaving?

(Woody Allen)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform