Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Leaving edited textbox with a navigation key
Message
From
21/10/1997 17:17:58
 
 
To
21/10/1997 16:16:07
Sonny Chouinard
CHCA Computer Systems Inc.
Lachenaie, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00055676
Message ID:
00055871
Views:
38
>>>>>The light is .click'ing on for me. It looks like we're both right! I don't use a cmdSave button (but rely on a toolbar equivalent I built that calls _screen.activeform.save(), or keyboard navigation that does thisform.save() defined in the form's keypress event). When I added a button with a cmdSave.click holding thisform.save(), everything worked exactly as you described. When I used the toolbar or my hotkeys, it failed as I described.
>>>>>
>>>>>Looks like the only difference is that by using the command button, my last edited field looses focus before the tableupdate() fires. With the toolbar, it doesn't. I'll play with it for a while. Thanks for bearing with me.
>>>>
>>>>I think you could try to move focus off control programmatically.
>>>
>>>That's what I did a few weeks before, work's greate. The keyboard navigation doesn't react
>>>exactly the same as the mouse.
>>
>>Sonny
>>
>>I just got your note as I was replying to the other. What exactly did you do to solve the problem?
>>
>>Bob
>
>When you press the button on the toolbar, or use the shortcut, the valid and the lost
>focus doesn't fire. Because, you don't change the focus on the current form. So I had
>a cmdBox (Sounds like a patch, smells like a patch but it works). So when I fire the
>shortcut or toolbar, I set the focus (Explicitly) on the cmdBox) so the valid and
>lostfocus launch normally. That's the trick.
>
>P.S.: I don't like to patch things but this one is an exception...


It works!

I want to call the save routine from many different forms. Because I don't have any one control that I can count on always being there to set focus to, I added a cmdButton to my base FormEdit class with the name "cmdPhantom", the caption "Saving", and visible set to .f. I put it in the top left corner, out of the way.

The code in my toolbar Save click event now reads:

local cName
cName=_screen.activeform.ActiveControl.Name
_screen.activeform.cmdPhantom.visible = .t.
_screen.activeform.cmdPhantom.Setfocus()
_screen.activeform.cmdPhantom.visible = .f.
_screen.activeform.save()
_screen.activeform.&cName..SetFocus()

similar code goes in my keypress routine but with "thisform" instead of "_screen.activeform".

For the brief bit of time that cmdPhantom is visible, it says "Saving", then it goes away. If you don't like this, you could probably shrink it down to a very small size.

Hold on - just thought of something better (and at this time untested) ... instead of a cmdButton, how about a transparent label with only a null strung in it. Should work ???

Thanks to all for the great exchange. Hopefully everybody got something out of it.

Bob
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform