Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Has any one know the event firing Command button
Message
From
30/09/1997 13:01:50
 
 
To
29/09/1997 22:33:43
Larry Long
ProgRes (Programming Resources)
Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00052099
Message ID:
00052454
Views:
50
>>I have a command button on the screen and a number of fields. I have code that happens in the lost focus event of a control on the form. In the click event of the command button I want to set a flag then logic says that I can In the lost focus event of the control I can test the flag. But the lost focus event fires before the click event so this will not work. I need a way to tell me that I have press with the mouse down on the command button so that I can test for a status, I set the debugger to trace the following from the READ EVENTS which starts the event loop processing I see that gotfocus event of the continer contained in the form fires then the gotfocus event of the control fires. Back to the READ EVENT Then I click on the command button but the click event does not fire at this point but the lostfocus event of the control does fire which at this point back to the
>>READ EVENT I have to press on the Command button again this time the click event does fire and the rest of the code calls what it should, But it is to late to set the flag because the lostfocus of the control fired last time. I need a way to tell the application that I pressed the command button the first time when I press on it so I can set a flag. Any Ideas about how to do this One note: I set a break point in the debugger in the Gotfocus event of the container and their I was able to see that might be able to do some thing like controls(I) but what would I look for to tell If the command button was pressed before the lostfocus event of the control.
>>
>>fshaw@runestones.com
>If I follow (not sure that I do), you can "Add a property" to your form and call it "flag". Then in your click event you can store .t. to thisform.flag. Or you could possibly call the click method in your lost focus method.. ie.
>
>Command1.LOSTFOCUS method
>-----------------------------------------------------
>thisform.command2.click()
>(then the rest of your lostfocus code)
>
>If I am not even close maybe it would be better to explain again precisely what you are looking to do. Perhaps it would be easier if you used terms like
>
>command1.click() - needs to do this
>command2.lostfocus() - needs to do that
>
>Let me know if I helped at all //:^)

I am also a little unclear on what you are trying to do, but trying to piece it together from this and previous posts, here's an idea that might help:
Create a custom property in your form called lastcontrol. In the lostfocus event of the controls on your form, issue:

thisform.lastcontrol = this.name

That way in the click event of the button that must determine where focus came from, you can say:
DO CASE
case thisform.lastcontrol = text1
blah blah blah
case thisform.lastcontrol = text2
bling bling bling
ENDCASE
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform