зеркало из https://github.com/microsoft/cocos2d-x.git
closed #4291:open CCEditBox as modal dialog
This commit is contained in:
Родитель
87b657b5bb
Коммит
0aaa1dc0db
|
@ -26,8 +26,17 @@
|
|||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
|
||||
#ifndef GLFW_EXPOSE_NATIVE_WIN32
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#endif
|
||||
|
||||
#ifndef GLFW_EXPOSE_NATIVE_WGL
|
||||
#define GLFW_EXPOSE_NATIVE_WGL
|
||||
#endif
|
||||
|
||||
#include "CCEditBox.h"
|
||||
#include "proj.win32/Win32InputBox.h"
|
||||
#include "glfw3native.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
|
@ -275,7 +284,10 @@ void EditBoxImplWin::openKeyboard()
|
|||
std::string text = getText();
|
||||
if (text.length())
|
||||
strncpy(pText, text.c_str(), 100);
|
||||
bool didChange = CWin32InputBox::InputBox("Input", placeHolder.c_str(), pText, 100, false) == IDOK;
|
||||
GLView *glView = Director::getInstance()->getOpenGLView();
|
||||
GLFWwindow *glfwWindow = glView->getWindow();
|
||||
HWND hwnd = glfwGetWin32Window(glfwWindow);
|
||||
bool didChange = CWin32InputBox::InputBox("Input", placeHolder.c_str(), pText, 100, false, hwnd) == IDOK;
|
||||
|
||||
if (didChange)
|
||||
setText(pText);
|
||||
|
|
|
@ -210,7 +210,7 @@ INT_PTR CWin32InputBox::InputBox(
|
|||
param.szResult = szResult;
|
||||
param.nResultSize = nResultSize;
|
||||
param.bMultiline = bMultiLine;
|
||||
|
||||
param.hwndOwner = hwndParent;
|
||||
return InputBoxEx(¶m);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче