>I have a form -- mostly a bunch of bound text boxes, some command buttons. It's part of a form set with one other form. Here's the odd behavior: a certain command button seems to retain the focus, even when it doesn't have the focus. Ahem, what I mean is: the outer border of the command button stays highlighted, but the button caption no longer has the dotted line around it -- kind of like a *partial* focus. It also becomes the default action for the form when
is pressed, but only when certain other types of controls have the focus. For example, if another command button has the focus, the problem button has no focus at all. If a check box has the focus, the button has partial focus and is activated when is pressed. If a bound text box has the focus, the command button has partial focus, but allows the cursor to advance to the next control (except when the problem button is disabled, in which case basically nothing happens in the text box when is
>pressed -- which makes sense, since if is associated with the button, and the button is disabled, then should be disabled as well).
>
>I realize that what I am calling "partial focus" is a normal occurrence in Windows interfaces -- a button that is the default action for a form when is pressed, even if the button doesn't have the focus. But this is not my intention, and I know of no way to do this in VFP anyway. I suppose I'm doing something inadvertently, but so far I've been unable to see it. It's making my form interface awkward -- sometimes advances from a text box, sometimes not.
>
>Anybody who can solve this will have my awe.
Far before I realized there's a .default property on command buttons, I've found the KeyPress... so my textbox classes have this in it:
case nKeyCode=13
keyboard "{tab}" plain
nodefault
....
Later I've learned that just issuing ThisForm.SetAll("default", .f., "commandbutton") doesn't make it sure every time, because there's always a chance some bit of code is setting some button as the default button, and that'd be very hard to track, so I've kept this. I know that talking to myself via keyboard is not a healthy practice, but I kept this, because it works just fine.