Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Entering data into grid
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00735860
Message ID:
00735907
Views:
11
Sorry, I got my pre in the wrong place!!

>Cetin, I am not sure you addressed the fact that when the amount field has cents (ie..1300.55 vs 1300.00), the valid event does not appear to fire because it does not sense a keypress or lastkey. I think there is a default of an "end of input" and since it is the last field in the grid it defaults to the first field instead of "arrowdown". Look at my notes: by the way I appreciate you cleaning up my code.
>Thanks
>>
>>Chuck,
>>I couldn't see a relation of this code to valid. It always returns .T., right ?
>>I wouldn't count and sum all records all the time. It might be really time consuming as reccount increases.
>>
>>
>>*Initialize - ie: in form.init
>>local array arrCompute[1]
>>set deleted on
>>select sum(amt) from myTable into array arrCompute
>>
>>WITH ThisForm
>> .txtEnterTotal.VALUE=iif(_Tally=0,0,arrCompute)
>> .txtTotRecCnt.VALUE=_Tally
>>ENDWITH
>>
>
>*** are these in the valid ?
>*** since there are no ADD/EDIT buttons
>*** how do you know when a record has been added or deleted
>*** maybe create a method for the init call and use it in
>*** the valid also?
>>*Any code adding to table also calls
>>WITH ThisForm.txtTotRecCnt
>> .VALUE=.Value+1
>>ENDWITH
>>
>>*Any code deleting from table also calls
>>WITH ThisForm.txtTotRecCnt
>> .VALUE=.Value-1
>>ENDWITH
>
>>
>
>please explain why i would use this.tag?
>>*TxtAmt.GotFocus
>>this.Tag = trans(this.Value)
>>
>>*TxtAmt.LostFocus
>>WITH ThisForm.txtEnterTotal
>> .VALUE = .Value + (this.Value - val(this.Tag))
>>ENDWITH
>>if !mdown() and inlist(lastkey(),13)
>> keyboard '{DNARROW}'
>>endif
>
>*** I had this set to true
>>*Grid.AllowAddNew= .t. would handle adding the new record if at bottom
>>
Cetin
Extreme Programming = Plan -> Design -> Code -> Test
Previous
Reply
Map
View

Click here to load this message in the networking platform