mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 03:44:43 +00:00
remove focus from window, when it gets diabled
- fixes bug 843 See issue #843 for more details. svn path=/trunk/; revision=25412
This commit is contained in:
parent
6af685313a
commit
b824f04492
1 changed files with 18 additions and 4 deletions
|
@ -36,6 +36,7 @@
|
||||||
/* Directory to load key layouts from */
|
/* Directory to load key layouts from */
|
||||||
#define SYSTEMROOT_DIR L"\\SystemRoot\\System32\\"
|
#define SYSTEMROOT_DIR L"\\SystemRoot\\System32\\"
|
||||||
|
|
||||||
|
#define STATE_GWL_OFFSET 0
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
@ -338,11 +339,24 @@ EnableWindow(HWND hWnd,
|
||||||
BOOL bEnable)
|
BOOL bEnable)
|
||||||
{
|
{
|
||||||
LONG Style = NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE);
|
LONG Style = NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE);
|
||||||
Style = bEnable ? Style & ~WS_DISABLED : Style | WS_DISABLED;
|
/* check if updating is needed */
|
||||||
NtUserSetWindowLong(hWnd, GWL_STYLE, Style, FALSE);
|
UINT bIsDisabled = (Style & WS_DISABLED);
|
||||||
|
if ( (bIsDisabled && bEnable) || (!bIsDisabled && !bEnable) )
|
||||||
SendMessageA(hWnd, WM_ENABLE, (LPARAM) IsWindowEnabled(hWnd), 0);
|
{
|
||||||
|
if (bEnable)
|
||||||
|
{
|
||||||
|
Style &= ~WS_DISABLED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Remove keyboard focus from that window */
|
||||||
|
SetFocus(NULL);
|
||||||
|
Style |= WS_DISABLED;
|
||||||
|
}
|
||||||
|
NtUserSetWindowLong(hWnd, GWL_STYLE, Style, FALSE);
|
||||||
|
|
||||||
|
SendMessageA(hWnd, WM_ENABLE, (LPARAM) IsWindowEnabled(hWnd), 0);
|
||||||
|
}
|
||||||
// Return nonzero if it was disabled, or zero if it wasn't:
|
// Return nonzero if it was disabled, or zero if it wasn't:
|
||||||
return IsWindowEnabled(hWnd);
|
return IsWindowEnabled(hWnd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue