Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't call setfocus() from init() ??????
Message
From
30/01/2003 14:38:19
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00747302
Message ID:
00747338
Views:
15
Rodolfo,

You are right! I responded back to myself, right before you posted this and explained the situation. This is exactly what I am doing. As I said in the post, I don't know why VFP cares if I am doing a setfocus() in a different form - but obviously it does.

In order to get around it I have done the following:
In my valid I am doing a seek for the text box value. If the seek succeeds I just return true. If it fails, I want to call my lookup form. Previously I was calling the form from inside my valid. Now, instead, if the seek fails I iissue:
this.tag='SEEKFAILED'

then in the lostfocus():

if this.tag='SEEKFAILED'
this.tag=''
do myform
** do the rest

endif

This seems to be working fine.


I am using vfp6, and am not in a position right now to recompile to 7, so, I hope my lostfocus() doesn't fire twice. This will be a big problem if it does. How can I avoid that. How else can I handle this?

Thanks for your help!







>Hello David,
>
>If you have one form (FORM_A) that has some objetcs (Form_A.Text1) and then, you call another form from this object (Form_A.Text1.Valid). For Example: DO FORM_B
>
>So, in FORM_B if you have a SETFOCUS (any event or method) you will receive this error message... It happens because you have a call from a VALID (not necessary the current object).
>
>Sorry about my English, but I think I could explain you what is doing wrong! :-)
>
>[]s!
>
>and... of couse, change the call (DO FORM_B) to LostFocus (instead Valid) and your program will work fine....
>If you are not using VFP 7, you could have problems with LostFocus... sometimes it runs twice...
>
>[]s again!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform