OK - Rafael - now I really AM Going to Pull My Hair OUT!!!
I did as you suggested - I put code into the LostFocus event - for the Style
and the Color fields. Well - I just got the well known error: "Cannot call
SetFocus from within a When, Valid, RangeHigh or RangeLow event."
Which I find to be QUITE Peculiar - since, in fact - I put the new line of
code into the SetFocus Method - which is NOT Listed in the Error above!
So - I have no clue as to why its giving that particular error...
-K-
-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of Rafael
Copquin
Sent: Wednesday, June 19, 2013 11:28 AM
To: [email protected]
Subject: Re: A Focus Problem - Not a Lack of Concentration!
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
---