mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 22:04:55 +02:00
parent
75bcb7c536
commit
f96d81af11
@ -369,7 +369,11 @@ private:
|
|||||||
// Update the edit box text.
|
// Update the edit box text.
|
||||||
// It will update the address if the path is a directory.
|
// It will update the address if the path is a directory.
|
||||||
if (nameChanged)
|
if (nameChanged)
|
||||||
sendDialogFileName(fileName.c_str());
|
{
|
||||||
|
// Clear the name first to ensure it's updated properly.
|
||||||
|
_dialog->SetFileName(_T(""));
|
||||||
|
_dialog->SetFileName(fileName.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transforms a forward-slash path to a canonical Windows path.
|
// Transforms a forward-slash path to a canonical Windows path.
|
||||||
@ -395,12 +399,6 @@ private:
|
|||||||
return transformed;
|
return transformed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the file name and waits until it is processed by the edit control.
|
|
||||||
void sendDialogFileName(const TCHAR* name)
|
|
||||||
{
|
|
||||||
::SendMessage(_hwndNameEdit, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enumerates the child windows of a dialog.
|
// Enumerates the child windows of a dialog.
|
||||||
// Sets up window procedure overrides for "OK" button and file name edit box.
|
// Sets up window procedure overrides for "OK" button and file name edit box.
|
||||||
static BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM)
|
static BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM)
|
||||||
@ -435,7 +433,23 @@ private:
|
|||||||
|
|
||||||
static LRESULT CALLBACK OkButtonWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
static LRESULT CALLBACK OkButtonWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
{
|
{
|
||||||
if (msg == WM_LBUTTONDOWN)
|
// The ways to press a button:
|
||||||
|
// 1. space/enter is pressed when the button has focus (WM_KEYDOWN)
|
||||||
|
// 2. left mouse click on a button (WM_LBUTTONDOWN)
|
||||||
|
// 3. Alt + S
|
||||||
|
bool pressed = false;
|
||||||
|
switch (msg)
|
||||||
|
{
|
||||||
|
case BM_SETSTATE:
|
||||||
|
// Sent after all press events above except when press return while focused.
|
||||||
|
pressed = (wparam == TRUE);
|
||||||
|
break;
|
||||||
|
case WM_GETDLGCODE:
|
||||||
|
// Sent for the keyboard input.
|
||||||
|
pressed = (wparam == VK_RETURN);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (pressed)
|
||||||
_staticThis->onPreFileOk();
|
_staticThis->onPreFileOk();
|
||||||
return CallWindowProc(_okButtonProc, hwnd, msg, wparam, lparam);
|
return CallWindowProc(_okButtonProc, hwnd, msg, wparam, lparam);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user