News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Focus

Started by oex, February 22, 2012, 11:52:13 PM

Previous topic - Next topic

oex

I've just started playing with windows controls.... I added a text box and that seems simple enough but what is the proper way to kill focus?

So basically like a webpage I want to remove focus from a text field when clicking on the main page (try with the search box on this page.... click in it then click the page background)

I'm assuming from some quick searches it has something to do with the WM_KILLFOCUS message? But I'm not sure if I have to set some property of the main window or of the control itself?

Sorry guys a stupid query I know but in the past I have coded only html page or command prompt interfaces except in VB which did it all for me :lol

Should I put:
invoke SetFocus, hWnd

In the wndproc WM_LBUTTONDOWN?
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

dedndave

the WM_SETFOCUS and WM_KILLFOCUS messages are not normally sent to a window "manually"
they are used to tell you when you have focus, or are about to loose it

instead, use the SetFocus function to set the focus to the main window
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646312%28v=vs.85%29.aspx
it will send messages to the window that will loose focus and the one that will get it - and change focus, of course   :P

oex

OK good I think I got this, ty
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv