Skip to content

Commit

Permalink
Merge pull request #177 from chcg/issue_176
Browse files Browse the repository at this point in the history
Issue 176
  • Loading branch information
chcg authored Dec 19, 2020
2 parents 222f497 + 78bedb5 commit f86d275
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion PythonScript/res/PythonScript.rc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,205,84,50,14
PUSHBUTTON "Cancel",IDCANCEL,256,84,50,14
LTEXT "Static",IDC_PROMPT,7,7,299,19
LTEXT "Static",IDC_PROMPT,7,7,299,19,SS_NOPREFIX
EDITTEXT IDC_USERTEXT,7,29,299,46,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL
END

Expand Down
13 changes: 7 additions & 6 deletions PythonScript/src/PromptDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "PromptDialog.h"
#include "resource.h"
#include "Notepad_Plus_msgs.h"
#include "WcharMbcsConverter.h"

PromptDialog::PromptDialog(HINSTANCE hInst, HWND hNotepad)
: m_hInst(hInst),
Expand Down Expand Up @@ -62,9 +63,9 @@ INT_PTR CALLBACK PromptDialog::runDlgProc(HWND hWnd, UINT message, WPARAM wParam
{
SendMessage(m_hNotepad, NPPM_MODELESSDIALOG, MODELESSDIALOGADD, reinterpret_cast<LPARAM>(hWnd));
m_hSelf = hWnd;
::SetWindowTextA(::GetDlgItem(m_hSelf, IDC_PROMPT), m_prompt.c_str());
::SetWindowTextA(m_hSelf, m_title.c_str());
::SetWindowTextA(::GetDlgItem(m_hSelf, IDC_USERTEXT), m_initial.c_str());
::SetWindowText(::GetDlgItem(m_hSelf, IDC_PROMPT), WcharMbcsConverter::char2tchar(m_prompt.c_str()).get());
::SetWindowText(m_hSelf, WcharMbcsConverter::char2tchar(m_title.c_str()).get());
::SetWindowText(::GetDlgItem(m_hSelf, IDC_USERTEXT), WcharMbcsConverter::char2tchar(m_initial.c_str()).get());
::SendMessage(::GetDlgItem(m_hSelf, IDC_USERTEXT), EM_SETSEL, 0, -1);
SetFocus(::GetDlgItem(m_hSelf, IDC_USERTEXT));

Expand All @@ -90,9 +91,9 @@ INT_PTR CALLBACK PromptDialog::runDlgProc(HWND hWnd, UINT message, WPARAM wParam
{
case IDOK:
{
char buffer[1000];
::GetWindowTextA(::GetDlgItem(m_hSelf, IDC_USERTEXT), buffer, 1000);
m_value = buffer;
TCHAR buffer[1000];
::GetWindowText(::GetDlgItem(m_hSelf, IDC_USERTEXT), buffer, 1000);
m_value = WcharMbcsConverter::tchar2char(buffer).get();
m_result = RESULT_OK;
}
//lint -fallthrough
Expand Down

0 comments on commit f86d275

Please sign in to comment.