Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Value in grid from one row carries forward to another
Message
From
30/04/2009 09:46:01
 
 
To
30/04/2009 09:34:08
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01397096
Message ID:
01397171
Views:
46
>
>
>*-- gotfocus of text control in grid
>this.Tag=str(this.Value)
>
>**-- fixed problem by adding the below code to the lostfocus of text control in grid
>*-- don't know why this solved problem - i copied the code
>*--from an almost identical form that this new system is modeled after.
>*-- I realized that the new code was the same as the old with the 
>*--exception of this piece. I don't know why this is needed. I understand
>*-- why I need to capture the value of the control upon entry into
>*-- the grid's textbox, but why on exit? I have no idea why this
>*-- fixed the problem
>
>*-- lost focus of text control in grid
>this.Tag=str(this.Value)
>
>
>*-- valid of text control in grid
>*-- i am using the tag property to capture changes to the grid text control
>*-- instead of using buffering or some other method
>If This.Value <> val(This.Tag)
>
>	ln_reserve_calc=cc_soman.nordqty - cc_soman.nshipqty-cc_soman.nsubdamt-cc_soman.ncancdamt- cc_soman.nadjreserved - cc_soman.nadjoporeserved
>
>	If ln_reserve_calc < 0
>		Messagebox('You can not over reserve, the quantity you entered would result in a negative unreserved of ' + Str(ln_reserve_calc),0+64,'Negative Unreserved')
>		ln_retval=0
>	Else
>		lndifference=cc_soman.nadjreserved-Val(This.Tag)
>		*ln_actual_qty_reserved= thisform.update_po_reserved(lndifference)
>		*-- second parameter true - called from manual - will wait with messageoboxes if necessary
>		ln_actual_qty_reserved= Thisform.update_onhand_reserved(lndifference,.T.)
>		Replace cc_soman.nadjallreserved With cc_soman.nadjallreserved+(lndifference ) In cc_soman
>		ln_retval=1
>	Endif
>
>Else
>	ln_retval=1
>Endif
>Return ln_retval
>
>
This is quite common trigger on lostfocus ensuring that some code will be fired only if textbox.value changed, i.e. it will not fire if you just tab through controls. I would use somewhat different code in case of ln_reserve_calc less than 0 to reverse erroneous input and return focus to the textbox.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform