Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Command Button - New To API Calls in Fox Pro
Message
From
29/09/1997 17:43:10
 
 
To
29/09/1997 16:19:31
Frank Shaw
Runestones Development Corporation
Ipswich, Massachusetts, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00052189
Message ID:
00052292
Views:
47
>>>>>I have not used API calls in foxpro I did have some experince using them in Visual basic a while back and I remember that when I can not get something to work the way I wanted it to I could always call a API function that would do the trick. I have read that call back functions are not supported in foxpro Is that true. I want to trap the user pressing the command button when he press the button will a API call help or does some have any other ideas. In am using Windows 95 and I want to trap the command button being pressed before lostfocus event of another control. Or better yet how to tell what control has been pressed in the activate or gotfocus event of a form with a container. If the answer is a API call how do I setup the call and then call the function. What place in the code should I set up the declare or and example of code. Do I need a call back function and how can I do it in foxpro. Is their a 3rd party that has built call back functions in foxpro. My other option I
>guess
>>>>>would be to do something about the event handler in foxpro can I modify it to know where and what control has been pressed last. Pardon my fishing but I am looking for some type of solution to my problem.
>>>>>
>>>>>
>>>>>Frank H. Shaw
>>>>>fshaw@runestones.com
>>>>
>>>>Frank, you are going too far. The problem doesn't require API calls. Use following:
>>>>*** your control LostFocus event
>>>>thisform.command1.click()
>>>>if thisform.flag1=.t.
>>>> =messagebox("really clicked")
>>>>endif
>>>>*** command1 click event
>>>>thisform.flag1=.t.
>>>>**** more code
>>>
>>>
>>>So what you are saying in the lostfocus event of the active control call the command buttons click methord in the click methord set a flag and return upon checking the status of the flag then in the lostfocus event of the control to see if it is set. That would work if their is a way to tell I come from the lostfocus event or from clicking the button directly. I guess I could do that with a flag also.
>>>
>>>But is their a way to tell what control was last used. Or trap the window message I do remember that in visual basic I was able to setup a control called a window hook and then I could monitor the window messages before the application gets them. Does FoxPro support this type of API function. How about a third party solution. I remember the button sent a WM_COMMAND message to its parent and places a Button Id value in the wParam value of the message. The lParam would contain the button controls window handle in the low order word and the notification code like BN_CLICKED in the high order word. Can this be done in foxpro use a API to monitor the window message before the application or foxpro gets them. And how does this different in windows 95 machine using visual foxpro 5.0a. Then I would know for shure what button was clicked.
>>>
>>>
>
>I guess what I am realy saying the following happens the control gets focus which is the first control on a form but in this case inside a container. When the user clicks on the button the control loose its focus and we go to the READ EVENT then the user is redisplayed the form in the READ EVENT this time the user clicks of the button the click event of the command button fires. I need to know not on the second time. But the first time that I click the button. Putting another way I need to know what control the focus is going to go to bettween the lost focus of the control with focus and the control the focus will go to before the focus gets their. Which is the command button pressed at the time focus is on another control this is to know if the code is the lost focus event of the first control gets executed or not. I also want to set up a loop in the Got Focus of the container so code that checks each button and control to see which is the last control the user pressed. I do not want
>the lost focus event to fire the click event of the button because I want that to happen by the user pressing the command button.
>
>The other way might be said can the READ EVENT be modifyed so the event loop or is there a way to look at the EVENT loop and know where the next control is the control to get focus. How does foxpro know that the control to get focus is the command button. Can I get access to the structure. If FoxPro does and windows does then why canot my application know also, Then If I know that peice of information which is what control will be getting focus next then I can I a loop tell where the user is at any given time. I hope my reason make sence maybe I am missing something.
>
>>>>>Frank H. Shaw
>>>>>fshaw@runestones.com
>>
>>Well, there are two things:
>>1. As far as I know, VB-like callback is not available (I spoke with my VB friend and I have no VFP insight on this topic).
>>2. However, VFP OOP model will allow you to avoid the necessity of 'callback'. You probably should look at your form design (surely I cannot do it) and make some improvements. The question is: why it's so important not to fire Textbox.Lostfocus before Command.Click. Remember thet LostFocus event is not the only place to make some validations, etc. E.g. look at InteractiveChange event.

Frank,
Simple question.. Are you doing this using Visual FoxExpress ?? Just wondering..

Thanx,

Tony Miller
Vancouver, Wa
Previous
Reply
Map
View

Click here to load this message in the networking platform