More TODO resolution.

This commit is contained in:
Pietro Gagliardi 2015-04-08 20:01:33 -04:00
parent ae31cbc089
commit f2537aadd3
3 changed files with 5 additions and 6 deletions

View File

@ -72,6 +72,8 @@ uiControl *uiNewButton(const char *text)
p.dwExStyle = 0; p.dwExStyle = 0;
p.lpClassName = L"button"; p.lpClassName = L"button";
wtext = toUTF16(text);
p.lpWindowName = wtext;
p.dwStyle = BS_PUSHBUTTON | WS_TABSTOP; p.dwStyle = BS_PUSHBUTTON | WS_TABSTOP;
p.hInstance = hInstance; p.hInstance = hInstance;
p.onWM_COMMAND = onWM_COMMAND; p.onWM_COMMAND = onWM_COMMAND;
@ -81,12 +83,9 @@ uiControl *uiNewButton(const char *text)
p.preferredSize = preferredSize; p.preferredSize = preferredSize;
p.data = b; p.data = b;
b->c = uiWindowsNewControl(&p); b->c = uiWindowsNewControl(&p);
uiFree(wtext);
hwnd = (HWND) uiControlHandle(b->c); hwnd = (HWND) uiControlHandle(b->c);
wtext = toUTF16(text);
if (SetWindowTextW(hwnd, wtext) == 0)
logLastError("error setting button text in uiNewButton()");
uiFree(wtext);
SendMessageW(hwnd, WM_SETFONT, (WPARAM) hMessageFont, (LPARAM) TRUE); SendMessageW(hwnd, WM_SETFONT, (WPARAM) hMessageFont, (LPARAM) TRUE);
b->onClicked = defaultOnClicked; b->onClicked = defaultOnClicked;

View File

@ -90,7 +90,7 @@ uiControl *uiWindowsNewControl(uiWindowsNewControlParams *p)
c = uiNew(uiSingleHWNDControl); c = uiNew(uiSingleHWNDControl);
c->hwnd = CreateWindowExW(p->dwExStyle, c->hwnd = CreateWindowExW(p->dwExStyle,
p->lpClassName, L"", p->lpClassName, p->lpWindowName,
p->dwStyle | WS_CHILD | WS_VISIBLE, p->dwStyle | WS_CHILD | WS_VISIBLE,
0, 0, 0, 0,
100, 100, 100, 100,

View File

@ -13,7 +13,7 @@ struct uiWindowsNewControlParams {
// These match the CreateWindowExW() function. // These match the CreateWindowExW() function.
DWORD dwExStyle; DWORD dwExStyle;
LPCWSTR lpClassName; LPCWSTR lpClassName;
//TODO? LPCWSTR lpWindowName; LPCWSTR lpWindowName;
DWORD dwStyle; // WS_CHILD and WS_VISIBLE are automatically applied. DWORD dwStyle; // WS_CHILD and WS_VISIBLE are automatically applied.
HINSTANCE hInstance; HINSTANCE hInstance;