Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid empty after TableRevert(.f.)
Message
 
 
À
05/11/2001 04:59:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00576215
Message ID:
00577309
Vues:
21
Hi!
    CASE EMPTY(evaluate(THIS.Column1._TextBox1.ControlSource)) && <b>or use the field from alias instead in AfterRowColChange, value of control in BeforeRowColChange</b>
        && Never mind if it's newly added, it must not be empty
        llRetval=TABLEREVERT(.F.,"ActiveMembers")
	IF EOF("ActiveMembers")
	   skip -1
           this.Refresh
	ENDIF
Above way for moving to previous row works well in AfterRowColChange, not sure about BeforeRowColChange - just try it, maybe, without refresh - did not tested.

Also, above you see that you have to pay more attention to the way of getting value. Valu from field is not saved when BeforeRowColChange called. It is savd to fied in AfterRowColChange called and could be *different* from what is in field because value of the control in grid used to refresh other rows and as a result can contain any other value from other rows.

HTH.

>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...
>>
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform