Edit Control - GotFocus not working?

F

farseer

Hi,
i have today app that displays a text box. The code below is called
from the WndProc handler when a WM_LBUTTONDOWN message is detected. On
the first pass, it works fine. That is, when i scroll down to my today
item from the today scree, then click the dpad center key, SendMessage
with a WM_SETFOCUS is called to set the focus to my edit control.
HOWEVER, i have come to realize that GetFocus always returns the handle
of the DesktopExplorer and NOT my edit control, even though it has the
focus. Why is this and how can i determine whether my edit control
has the input focus?

void MyTodayApp::OnLButtonUp(UINT nFlags, POINT point)
{
HWND focusCtl = GetFocus( );
int textLen = SendMessage( m_hEditBox, WM_GETTEXTLENGTH, 0 , 0 );

if ( ( focusCtl != m_hEditBox ) )
SendMessage( m_hEditBox, WM_SETFOCUS, 0, 0 );
else if ( textLen > 0 )
MessageBox(NULL, TEXT("Submitting data"), TEXT("Submitting data:"),
MB_OK);
}
 
F

farseer

another issue with this. if i setfocus using SendMessage, i can no
longer type in that edit box...nothing is outputted. very strange, i
think
 
F

farseer

and you cannot mix native and managed code when doing compact framework
development?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top