Information générale
Catégorie:
Codage, syntaxe et commandes
Steve,
You set the new button to (try to) be DEFAULT. BUT, do you change the prior one which was DEFAULT to be .Default=.F.???
This is just a guess, by the way.
good luck
Jim N
>>>I'm having a slight problem. In one of my fields on a form,
>>>I have the following code in the SetFocus method:
>>>
>>>thisform.cmdSetName.Default=.T.
>>>
>>>Shouldn't that make the command button the default? When you click
>>>on the field, you can see the command button flicker, but it doesn't
>>>retain the dark border around it indicating that it's the default
>>>button (and it's proven when nothing happens when you hit enter except
>>>that focus leaves the input field and moves to the next object).
>>>
>>>I also have a similar line of code in the LostFocus method of that
>>>same field. It is:
>>>
>>>thisform.cmdOK.Default=.T.
>>>
>>>Same behavior as above. Am I doing something wrong?
>>
>>I don't understand why you are doing this, :)
>>but probably you should handle Enter key pressing in textbox KeyPress event:
>>
>>if nkeyCode = 13
>>this.parent.myCmdbutton.Click()
>>NODEFAULT
>>endif
>
>I'm doing this because I want the default button to be my OK button except when
>in a certain field. When focus is in this certain field, I want a different
>command button to be the default. I'm just trying to avoid coding something
>that is already built in to the system. I understand your example, though. I
>would just rather my initial attempt would work! I just don't understand why
>something so simple as thisform.mycmdbutton.default=.T. won't work properly!
>I must investigate and see what's the problem. Thank you, though!!
>
>Steve :)
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement