From eed0eb6a476d54ce19aeff137984aa981d9e3976 Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 15 Jun 2010 00:59:57 -0700 Subject: Upgrading to iup 3.1 --- iup/src/win/iupwin_focus.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'iup/src/win/iupwin_focus.c') diff --git a/iup/src/win/iupwin_focus.c b/iup/src/win/iupwin_focus.c index 63da02d..2328dea 100755 --- a/iup/src/win/iupwin_focus.c +++ b/iup/src/win/iupwin_focus.c @@ -32,7 +32,7 @@ /* Since Windows XP, the focus feedback only appears after the user press a key. Except for the IupText where the feedback is the caret. - Before that if you click in a control the focus feedback will be hidden. + Before a key is pressed if you click in a control the focus feedback will be hidden. We manually send WM_CHANGEUISTATE because we do not use IsDialogMessage anymore, and the focus feedback was not shown even after the used press a key. @@ -43,19 +43,28 @@ void iupdrvSetFocus(Ihandle *ih) { SetFocus(ih->handle); - SendMessage(ih->handle, WM_CHANGEUISTATE, UIS_CLEAR|UISF_HIDEFOCUS, 0); + + /* See comments above */ + SendMessage(ih->handle, WM_CHANGEUISTATE, UIS_CLEAR|UISF_HIDEFOCUS, 0); /* clear+hidefocus=showfocus */ } void iupwinWmSetFocus(Ihandle *ih) { Ihandle* dialog = IupGetDialog(ih); if (ih != dialog) - iupAttribSetStr(dialog, "_IUPWIN_LASTFOCUS", (char*)ih); /* used by IupMenu */ + iupAttribSetStr(dialog, "_IUPWIN_LASTFOCUS", (char*)ih); /* used by IupMenu and here. */ else { /* if a control inside that dialog had the focus, then reset to it when the dialog gets the focus */ Ihandle* lastfocus = (Ihandle*)iupAttribGet(dialog, "_IUPWIN_LASTFOCUS"); - if (lastfocus) IupSetFocus(lastfocus); + if (lastfocus) + { + /* call the callback and update current focus before changing it again */ + iupCallGetFocusCb(ih); + + IupSetFocus(lastfocus); + return; + } } iupCallGetFocusCb(ih); -- cgit v1.2.3