Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What method to use instead of Refresh?
Message
 
 
To
21/06/2012 11:44:03
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01546511
Message ID:
01546520
Views:
47
>>>>Hi,
>>>>
>>>>I have a textbox "bound" to a cursor/view. I put bound in quotation marks because I don't want to use the ControlSource of the text box. Instead the "binding" has to be done in code. So that every time the record pointer moves, a new value appears in the text box. Natural thing would be to put this code in the Refresh method of the text box. But I think that Refresh would fire too often; even when the record pointer has not moved. What other method would you recommend to use for this purpose? TIA.
>>>
>>>Use valid() method.
>>
>>Would Valid() automatically fire on every record pointer move?
>
>No, I don't think it would. Why don't you just bind right after the record pointer moves. I am assuming, of course, that your code is aware of when the pointer moves.
>
>But then again, I'm a little confused as to why you don't bind to the table field at the get-go and then the form level refresh would handle the textbox level, unless you're actually changing the field the textbox is bound to, and again - why not do the binding there, since you KNOW things have changed.

That was the point that the code is not aware when the record pointer has moved. But since I posted the initial message I decided that the only way to do it is to put some code in the Refresh method where it would be determined if record pointer has moved. Then, in that case, the "binding" occurs. So it comes back to the Refresh method but hopefully it won't slow down the application.

As to your confusion. Here is why I don't/can't bind to the field. The field to which this textbox is "bound" is a PK field. But the value displayed should be a name field (another field). So I have to "seek" in the base table for the PK value and display the Name field on every record pointer move.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform