mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
- Change DIALOG_CreateIndirect location in source to make DEFDLG_SaveFocus available for use.
- DIALOG_CreateIndirect: The current window with focus could have been set in the dialog's procedure, so save the current focused window after sending WM_INITDIALOG and before any other message are sent that modify focus. - Fixes setting focus on Open and Close dialogs to the FileName edit control in OpenOffice. svn path=/trunk/; revision=43396
This commit is contained in:
parent
6eb3586017
commit
6be2aea1b3
1 changed files with 56 additions and 55 deletions
|
@ -682,7 +682,59 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
|
||||||
return (LPCSTR)((((UINT_PTR)p) + 3) & ~3);
|
return (LPCSTR)((((UINT_PTR)p) + 3) & ~3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
* DEFDLG_SetFocus
|
||||||
|
*
|
||||||
|
* Set the focus to a control of the dialog, selecting the text if
|
||||||
|
* the control is an edit dialog.
|
||||||
|
*/
|
||||||
|
static void DEFDLG_SetFocus( HWND hwndDlg, HWND hwndCtrl )
|
||||||
|
{
|
||||||
|
if (SendMessageW( hwndCtrl, WM_GETDLGCODE, 0, 0 ) & DLGC_HASSETSEL)
|
||||||
|
SendMessageW( hwndCtrl, EM_SETSEL, 0, -1 );
|
||||||
|
SetFocus( hwndCtrl );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* DEFDLG_SaveFocus
|
||||||
|
*/
|
||||||
|
static void DEFDLG_SaveFocus( HWND hwnd )
|
||||||
|
{
|
||||||
|
DIALOGINFO *infoPtr;
|
||||||
|
HWND hwndFocus = GetFocus();
|
||||||
|
|
||||||
|
if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return;
|
||||||
|
if (!(infoPtr = GETDLGINFO(hwnd))) return;
|
||||||
|
infoPtr->hwndFocus = hwndFocus;
|
||||||
|
/* Remove default button */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* DEFDLG_RestoreFocus
|
||||||
|
*/
|
||||||
|
static void DEFDLG_RestoreFocus( HWND hwnd )
|
||||||
|
{
|
||||||
|
DIALOGINFO *infoPtr;
|
||||||
|
|
||||||
|
if (IsIconic( hwnd )) return;
|
||||||
|
if (!(infoPtr = GETDLGINFO(hwnd))) return;
|
||||||
|
/* Don't set the focus back to controls if EndDialog is already called.*/
|
||||||
|
if (infoPtr->flags & DF_END) return;
|
||||||
|
if (!IsWindow(infoPtr->hwndFocus) || infoPtr->hwndFocus == hwnd) {
|
||||||
|
/* If no saved focus control exists, set focus to the first visible,
|
||||||
|
non-disabled, WS_TABSTOP control in the dialog */
|
||||||
|
infoPtr->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
|
||||||
|
if (!IsWindow( infoPtr->hwndFocus )) return;
|
||||||
|
}
|
||||||
|
DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
|
||||||
|
|
||||||
|
/* This used to set infoPtr->hwndFocus to NULL for no apparent reason,
|
||||||
|
sometimes losing focus when receiving WM_SETFOCUS messages. */
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
* DIALOG_CreateIndirect
|
* DIALOG_CreateIndirect
|
||||||
* Creates a dialog box window
|
* Creates a dialog box window
|
||||||
*
|
*
|
||||||
|
@ -923,6 +975,9 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
|
||||||
if( dlgInfo->hwndFocus )
|
if( dlgInfo->hwndFocus )
|
||||||
SetFocus( dlgInfo->hwndFocus );
|
SetFocus( dlgInfo->hwndFocus );
|
||||||
}
|
}
|
||||||
|
//// ReactOS
|
||||||
|
DEFDLG_SaveFocus( hwnd );
|
||||||
|
////
|
||||||
}
|
}
|
||||||
//// ReactOS Rev 30613 & 30644
|
//// ReactOS Rev 30613 & 30644
|
||||||
if (!(GetWindowLongPtrW( hwnd, GWL_STYLE ) & WS_CHILD))
|
if (!(GetWindowLongPtrW( hwnd, GWL_STYLE ) & WS_CHILD))
|
||||||
|
@ -939,60 +994,6 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* DEFDLG_SetFocus
|
|
||||||
*
|
|
||||||
* Set the focus to a control of the dialog, selecting the text if
|
|
||||||
* the control is an edit dialog.
|
|
||||||
*/
|
|
||||||
static void DEFDLG_SetFocus( HWND hwndDlg, HWND hwndCtrl )
|
|
||||||
{
|
|
||||||
if (SendMessageW( hwndCtrl, WM_GETDLGCODE, 0, 0 ) & DLGC_HASSETSEL)
|
|
||||||
SendMessageW( hwndCtrl, EM_SETSEL, 0, -1 );
|
|
||||||
SetFocus( hwndCtrl );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* DEFDLG_SaveFocus
|
|
||||||
*/
|
|
||||||
static void DEFDLG_SaveFocus( HWND hwnd )
|
|
||||||
{
|
|
||||||
DIALOGINFO *infoPtr;
|
|
||||||
HWND hwndFocus = GetFocus();
|
|
||||||
|
|
||||||
if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return;
|
|
||||||
if (!(infoPtr = GETDLGINFO(hwnd))) return;
|
|
||||||
infoPtr->hwndFocus = hwndFocus;
|
|
||||||
/* Remove default button */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* DEFDLG_RestoreFocus
|
|
||||||
*/
|
|
||||||
static void DEFDLG_RestoreFocus( HWND hwnd )
|
|
||||||
{
|
|
||||||
DIALOGINFO *infoPtr;
|
|
||||||
|
|
||||||
if (IsIconic( hwnd )) return;
|
|
||||||
if (!(infoPtr = GETDLGINFO(hwnd))) return;
|
|
||||||
/* Don't set the focus back to controls if EndDialog is already called.*/
|
|
||||||
if (infoPtr->flags & DF_END) return;
|
|
||||||
if (!IsWindow(infoPtr->hwndFocus) || infoPtr->hwndFocus == hwnd) {
|
|
||||||
/* If no saved focus control exists, set focus to the first visible,
|
|
||||||
non-disabled, WS_TABSTOP control in the dialog */
|
|
||||||
infoPtr->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
|
|
||||||
if (!IsWindow( infoPtr->hwndFocus )) return;
|
|
||||||
}
|
|
||||||
DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
|
|
||||||
|
|
||||||
/* This used to set infoPtr->hwndFocus to NULL for no apparent reason,
|
|
||||||
sometimes losing focus when receiving WM_SETFOCUS messages. */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* DEFDLG_FindDefButton
|
* DEFDLG_FindDefButton
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue