Testing for control that HAS focus

Started by Martin Francom, January 27, 2010, 11:27:26 PM

Previous topic - Next topic

Martin Francom

I am trapping the  ESC key in the FF_PUMPHOOK function.

    I want to do one thing a if a particular TextBox has FOCUS   and do something else if that  TextBox  does not have FOCUS.

    How can I test to find out if a particular TextBox has FOCUS ?

José Roca

Call GetFocus and check if the returned handle is the same as the one of your control.

Martin Francom

#2
ahh... yes... very good.  thank you Jose


I don't see GetFocus as a FF function  and it doesn't seem to be a PB command.  I found a   FF_Control_SetFocus   in the Function Library  but no  FF_Control_GetFocus.    Is it just a non documented function?    What is the syntax?

I am not sure how to use what your suggesting.

Rolf Brandt

GetFocus is a Win32 API function. You would call it:

res = GetFocus
msgbox str$(res) 'or ztrace str$(res)

It returns the handle of the window that has currently the focus.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Martin Francom


Paul Squires

Quote from: Marty Francom on January 28, 2010, 04:47:17 AM
I found a   FF_Control_SetFocus   in the Function Library  but no  FF_Control_GetFocus.    Is it just a non documented function?    What is the syntax?

Looks like it is time for me to write an "Survival Guide to WinAPI Functions". Need to cover the basic functions that every programmer needs to know. For example, I don't know where any programmer would be without GetWindowRect, GetClientRect, SetWindowPos, MapWindowPoints.......
Paul Squires
PlanetSquires Software

José Roca

There are two things that anybody wanting to master the Windows API and low-level COM needs to learn: 1) Parameter passing and calling conventions; 2) Pointers.

Gary Stout

Put my vote down for the API survial guide!
Coming from a product that shielded me from most of the API has me about as lost as a ball in tall weeds when it comes to doing things without them being wrapped in a EZ command   :-\ (some pun intended)

Gary

Rolf Brandt

#8
API Survival Guide? Y E S !

I used (and still do) a lot of API Function in VB6. I found the API-Guide from the KPD-Team (Dutch Web site, which is no longer available) very helpful. I still use their tool with about a thousand examples, declerations, infos, etc. Much of the code could be easily adapted to PB.

It is quite similar to the FF3 Functions Library I think the Functions Library as a standalone program would make a good API Survival Guide.

Just found the API-Guide on the Net, the guys put up a download site again. Have a look!
http://allapi.mentalis.org/agnet/apiguide.shtml
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

José Roca

I began something similar in my forum and posted several dozens of examples. See: http://www.jose.it-berater.org/smfforum/index.php?board=207.0

I will post more when time will allow. Currently I'm busy updating my Windows API Headers to Windows 7.

Martin Francom

Quote from: TechSupport on January 28, 2010, 10:07:25 PM
Quote from: Marty Francom on January 28, 2010, 04:47:17 AM
I found a   FF_Control_SetFocus   in the Function Library  but no  FF_Control_GetFocus.    Is it just a non documented function?    What is the syntax?

Looks like it is time for me to write an "Survival Guide to WinAPI Functions". Need to cover the basic functions that every programmer needs to know. For example, I don't know where any programmer would be without GetWindowRect, GetClientRect, SetWindowPos, MapWindowPoints.......


Yes, Paul that would be great.   I'm an old guy that never learned to swim, I have jumped in and am in water over my head.  Throwing this old guy a life ring would be most appreciated.   If your  "Survival Guide to WinAPI Functions" ever comes to fruition I most certainly would read it.   The next problem would be imbedding it in my memory, but at least I would have it for reference.

Hey, I appologize for the elementary questions that I ask from time to time.  And I appreciate the good humor with which you all tollerate them.  I am old enough now that I no longer get embarrassed when I ask the obvious. 

I hope from time to time I have been able to contribute a little.       

Rolf Brandt

There are some very helpful functions in your collection, Jose.

InternetGetConnectedState came in just handy for me, because I am writing a XP based mobile client program.

I am looking forward to more additions.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Paul Squires

Quote from: Marty Francom on January 29, 2010, 05:41:19 AM
Hey, I appologize for the elementary questions that I ask from time to time.  And I appreciate the good humor with which you all tollerate them.  I am old enough now that I no longer get embarrassed when I ask the obvious. 

I hope from time to time I have been able to contribute a little.       

No worries at all - your questions are always pertienent and you give back more than you take. The more questions that we all ask the better - that's what this programming community is all about. The worst thing that any of us can do is start to believe that we know more about programming than others. I'm lucky that over the last 10 or 15 years that I have gained a fair bit of knowledge (mostly through trial and error testing and writing programs like JellyFish and FireFly) but when i look at some of the stuff by the likes of Jose and Dominic, I just want to hide my head in shame! :)
Paul Squires
PlanetSquires Software

Thomas Cone Jr

The API Survival Guide is something I would be very very interested in, too.

-- tom

Roger Garstang

#14
Custom Control Guide would be good too.  I still want to get the improved FolderTree working I made back in FF3 beta that kept crashing.  It would be much nicer to pull the System Icons and not needing to have a DLL.  Even if it was just a low level showing what FF does when certain options are picked, code snips from FF's custom control functions, differences and changes needed when control uses DLL and without, etc.  I'm alright making the code, it is how to integrate it with FF that wasn't so clear.