Very often I run into the same problem. Here's what I do:

After validation in a textbox valid event (the next event will be lostfocus). Then in the lostfocus event I put:

thisform.nextcontrolwherefocusshouldbe.setfocus

If validation comes from a lookup form, the code is this:

** call the lookup form
do form mylooupform to whatevervalueisreturnedfromthelookupform
** more code here to do whatever the returned value should be used for
thisform.nextcontrolwherefocusshouldbe.setfocus

And if for some reason focus goes to a control where it should not go, by all means, use your kludge. I do it when necessary, many hairs are prevented from falling off my head and I go on to the next issue, whatever it may be.

Not always doing things "the right way" work the way you want them to. The important things are:

a) your program should do what it is supposed to do
b) you use your time productively
c) the code you write can be easyly followed up for future changes (make notes in your code explaining your kludge)

Rafael Copquin



El 19/06/2013 11:52 a.m., Kurt Wendt escribió:
I'm going kinda Crazy here with some strange Focus problems on this Form.

So - I have this Form - for the Inquire, Mod. & Entry of PO Lines. Currently
I am working just on PO Lines creation. The Inquire & Mod. Modes are already
working.

I have this Grid - where the PO Lines will be displayed. I also have a
Container at the bottom of the Form - which pops-up & allows entry of Style,
Color, Desc,, Qty's, and such. Since this is Entry/Creation mode - I have it
on right when you go into the screen - and the Style gets the Focus. That
part is working fine.

So - upon entry of a Style - if its Valid (its checked against a Style DBF)
- then the Focus is SUPPOSED to move onto the next field - the Color.
However, after its checked and found to be Valid (no need for a Look-up) -
the Focus jumps to the Grid! WTF!?!? I can't explain WHY It is doing that!

As such, I decided to "Fudge" things - to attempt to force it to work. So -
I DisAbled the Grid. Now, after entering a Valid Style - it then DOES go to
the Color field for entry. But, I don't really like this Kludgy solution.
Especially since there are More issues.

Now - if the Style is NOT Valid - I have it Pop-up a Lookup. This Lookup is
another Form to lookup Style/Color combos - and its used in other parts of
the system. Now, with the Grid Enabled set to False, and an invalid Style is
entered, and the Lookup window pops up - after making the selection - the
Focus goes BACK to the Style! That isn't right - as it should go to the Next
field - the Color!

Next - if put in a Valid Style, it goes to Color. Then, if I put in a Valid
Color - and there is no look-up, it properly goes to the next field,
Description. BUT - if I put in an Invalid Color, it does the Style/Color
lookup, and, upon return from that Lookup Screen/Form - the Focus goes BACK
to the Style! Which is of course NOT Correct!

I've actually thought about setting the Style field Enabled to False, upon
having it validated and moving to Color. Then, setting the Color field to
Enabled of False - upon having it properly validated. But, that sounds like
an even WORSE Kludge!

At this point - I rather find out Why things are not working right - and try
to fix it the proper way instead of using Kludges!

So - any advice is greatly appreciated!!!

Thanks,

-K-



--- StripMime Report -- processed MIME parts ---
multipart/alternative
   text/plain (text body -- kept)
   text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/51c1ce0d.3080...@fibertel.com.ar
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to