G
Guest
I've created a simulation of an Excel cell in one of my forms, such that the
user can enter a formula, but in leaving it displays the result. This is
implemented by two overlapping controls, txtFormula and txtResult.
txtFormula is bound to an underlying table field, while Result just displays
0 or the result of a Call to the Eval function.
txtResult is set to Enabled and Visible. In the OnGotFocus event, it makes
txtFormula Visible and Enabled, sets the focus there, then disables itself
and makes itself invisible.
I'd like to do just the opposite when I leave txtFormula, but I can't
disable it when it has the focus, which it does when called from the OnExit
or OnLostFocus event. I can do so from the OnEnter or OnGotFocus event of
the next control, which works fine, but the user *could* move backwards or
mouse-click into another control, in which case txtFormula would remain
enabled and visible. The only way I've been able to get it to work is to put
the code in the OnGotFocus event of each enabled control. While this works
now, I'd certainly like to know if there's a better way to do this for next
time. Can anyone tell me how?
user can enter a formula, but in leaving it displays the result. This is
implemented by two overlapping controls, txtFormula and txtResult.
txtFormula is bound to an underlying table field, while Result just displays
0 or the result of a Call to the Eval function.
txtResult is set to Enabled and Visible. In the OnGotFocus event, it makes
txtFormula Visible and Enabled, sets the focus there, then disables itself
and makes itself invisible.
I'd like to do just the opposite when I leave txtFormula, but I can't
disable it when it has the focus, which it does when called from the OnExit
or OnLostFocus event. I can do so from the OnEnter or OnGotFocus event of
the next control, which works fine, but the user *could* move backwards or
mouse-click into another control, in which case txtFormula would remain
enabled and visible. The only way I've been able to get it to work is to put
the code in the OnGotFocus event of each enabled control. While this works
now, I'd certainly like to know if there's a better way to do this for next
time. Can anyone tell me how?