mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
[SHELL32] Set the OK button in the run dialog as disabled by default unless text is added. By Mark Jansen. CORE-10436
svn path=/trunk/; revision=70206
This commit is contained in:
parent
f9e53e90df
commit
93fe673fa4
1 changed files with 31 additions and 0 deletions
|
@ -346,6 +346,27 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline)
|
|||
}
|
||||
}
|
||||
|
||||
static void EnableOkButtonFromEditContents(HWND hwnd)
|
||||
{
|
||||
BOOL Enable = FALSE;
|
||||
INT Length, n;
|
||||
HWND Edit = GetDlgItem(hwnd, IDC_RUNDLG_EDITPATH);
|
||||
Length = GetWindowTextLengthA(Edit);
|
||||
if (Length > 0)
|
||||
{
|
||||
PWCHAR psz = (PWCHAR)HeapAlloc(GetProcessHeap(), 0, (Length + 1) * sizeof(WCHAR));
|
||||
if (psz)
|
||||
{
|
||||
GetWindowTextW(Edit, psz, Length + 1);
|
||||
for (n = 0; n < Length && !Enable; ++n)
|
||||
Enable = psz[n] != ' ';
|
||||
HeapFree(GetProcessHeap(), 0, psz);
|
||||
}
|
||||
else
|
||||
Enable = TRUE;
|
||||
}
|
||||
EnableWindow(GetDlgItem(hwnd, IDOK), Enable);
|
||||
}
|
||||
|
||||
/* Dialog procedure for RunFileDlg */
|
||||
static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
@ -379,6 +400,7 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
|
|||
SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)prfdp->hIcon);
|
||||
|
||||
FillList (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH), NULL, (prfdp->uFlags & RFF_NODEFAULT) == 0);
|
||||
EnableOkButtonFromEditContents(hwnd);
|
||||
SetFocus (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH));
|
||||
return TRUE;
|
||||
|
||||
|
@ -472,6 +494,7 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
|
|||
SetFocus (GetDlgItem (hwnd, IDOK));
|
||||
SetWindowTextW (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH), szFName);
|
||||
SendMessageW (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH), CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
|
||||
EnableOkButtonFromEditContents(hwnd);
|
||||
SetFocus (GetDlgItem (hwnd, IDOK));
|
||||
}
|
||||
|
||||
|
@ -479,6 +502,14 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
case IDC_RUNDLG_EDITPATH:
|
||||
{
|
||||
if (HIWORD(wParam) == CBN_EDITCHANGE)
|
||||
{
|
||||
EnableOkButtonFromEditContents(hwnd);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue