Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using the Valid Events in a Grid
Message
From
28/09/2001 05:01:55
 
 
To
28/09/2001 03:15:34
Jimi Lee
Pop Electronic Products Ltd.
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00561814
Message ID:
00561823
Views:
23
This message has been marked as the solution to the initial question of the thread.
Hi!

Jimi,

Do not use grid column control’s "Value" property for calculations. To get data for calculations, do direct access to the grid alias data instead. This is because control in the inactive column is usually used for refreshing of the grid layout, and thus its Value property is not appropriate to the current row value - to draw next row acyive cell in that column during the process of moving to next row, value is changed to refresh grid properly.
if len(allt(eval(this.ControlSource)))<4 then
  wait window "flag 1"
  replace (this.ControlSource) with padl(eval(this.ControlSource), 4, "0") IN (this.parent.parent.RecordSource)
  wait window "flag 2"
endif
Of course, assure record pointer is at the correct record (though it always was at the correct record in the Valid event, as far as I know, just Value property set incorrectly).

HTH.

>Hi all,
>
>I have a grid, in MyGrid.Column1.Text1.Valid(), I have such code:
>
>if len(allt(this.value))<4 then
>  wait window "flag 1"
>  this.value=padl(this.value, 4, "0")
>  wait window "flag 2"
>endif
>
>
>I just want to ensure the content of this field have a length of 4 in all records, but it doesn't work.. there are two cases:
>
>(1)
>If I input "1", then use my mouse or press tab to setfocus to next column, both "flag 1" and "flag 2" are poped up, but the content of the cell didn't change..
>
>(2)
>If I input "1", then use my mouse ot press the down button to setfocus to next row, nothing would happen, no pop up window, content no change..
>But when I go back to the cell again, the "flag 1" and "flag 2" will appear, content still nor changed.
>
>I guess the grid used the value of the cell I have switched to, other than the original cell, but I think valid event is fired before it lostfocus, why did it not use the original value? How should I do?
>
>I need to be able to check the value by code because after setting the length to 4, I still have some other checking to perform in this cell, and have to change it's value if the tests are failed..
>
>I hope I've describe the problem clear enough, any idea or suggestions would be greatly appreciated!!
>
>Jimi
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform