This is the way I'll have to go. I'll have to create a new property and save the name of the active control into it. I'll probably to that from each control's gotfocus. Then in the gotfocus of the button I'll check if the last control was the textbox. If so, I'll run the button's click. Then set the last control property to the button.
I don't suppose you know a simpler way to handle figuring out where the button click came from? If you do, I'm open to it.
Thanks Doru.
>I had the same problem in VFP9 version 09.00.0000.2412, and was surprized that the messagebox eats the click. To get around it, I do a keyboard '{enter}' in the gotfocus of the button if the button is clicked coming from the text box.
>
>>Running vfp9 on WinXP SP2.
>>
>>When I have a messagebox in a textbox valid, and, with the textbox having focus, I click on a button, the button's click event doesn't fire. Is this a bug, or is it supposed to happen this way?
>>
>>Here is some simple code. Note that if you change command1.click to command1.rightclick, the rightclick event
will fire which makes me lean toward it being a bug.
>>
>>I thought it might make a difference if the messagebox didn't have to be closed manually, so I tried changing the
MessageBox("TextBox Valid")
to be
MessageBox("TextBox Valid",0,2000)
But it makes no difference. The button click doesn't fire.
>>
>>Anybody?
>>
>>oForm = CREATEOBJECT("Form1")
>>oForm.Show
>>READ events
>>
>>RETURN
>>
>>DEFINE CLASS form1 AS form
>> DoCreate = .T.
>> Caption = "Form1"
>> Name = "Form1"
>>
>> ADD OBJECT text1 AS textbox WITH ;
>> Height = 23, ;
>> Left = 96, ;
>> Top = 48, ;
>> Width = 100, ;
>> Name = "Text1"
>>
>> ADD OBJECT command1 AS commandbutton WITH ;
>> Top = 120, ;
>> Left = 96, ;
>> Height = 27, ;
>> Width = 84, ;
>> Caption = "Command1", ;
>> Name = "Command1"
>>
>> Procedure Destroy
>> Clear Events
>> ENDPROC
>>
>> PROCEDURE text1.Valid
>> MessageBox("TextBox Valid")
>> ENDPROC
>>
>> PROCEDURE command1.Click
>> MESSAGEBOX("button click")
>> ENDPROC
>>
>>ENDDEFINE
>>