Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Lostfocus (or valid) calls frm --> wierdness
Message
From
27/05/2009 11:30:05
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01402232
Message ID:
01402235
Views:
65
You could call lookup form from textbox.lostfocus and use NODEFAULT there in case of wrong input. It will ensure that save button will not get focus until user makes correct input.

>I have a form with a save button and container. The container is for doing lookups. It contains a textbox.
>
>The lost focus of the container calls a lookup form. If the user cancels out of the lookup form, it sets focus back to the textbox.
>
>I’m getting strange behavior:
>I put a blank in the textbox, and click save. It correctly shows a messagebox.
>
>I put bad value (‘asdfksdj’) in the textbox, and click save. The search form comes up, I cancel, focus returns to the textbox.
>
>I click save again, and the search form comes up and closes by itself in .1 seconds, and the bad value is saved.
>
>I spent a few days playing with it. The form is definitely modal. All the memvars are the same the first time and the second time it is called. It just behaves differently.
>
>I tried using valid instead of setfocus, but it didn’t help.
>
>Then I made two empty test forms to play with.
>
>When I click on the save button, the lookup form comes up. I cancel, and it goes back to the textbox, no problem.
>
>Lets try that again:
>
>When I click on the save button, the lookup form comes up. I click OK, and focus goes to the save button that I clicked on. However, the click event does not fire. It has been swallowed by the search form. I logged events and there it is, form.click.
>
>So, I have a model form that acts modeless the second time you call it.
>I have a click event that doesn’t fire.
>I also sometimes notice that the lostfocus and valid events fire twice.
>
>First I’d like to know why this is happening. Failing that, a workaround would do.
>
>Tracking which was the last control hit, and using this info in the save button’s gotfocus to manually call the click is really ugly.
>
>Other ideas?
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform