From f2537aadd3aa864b49fc618ce999031e6c95edd1 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 8 Apr 2015 20:01:33 -0400 Subject: [PATCH] More TODO resolution. --- button_windows.c | 7 +++---- newcontrol_windows.c | 2 +- ui_windows.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/button_windows.c b/button_windows.c index a257e156..9d3ae65f 100644 --- a/button_windows.c +++ b/button_windows.c @@ -72,6 +72,8 @@ uiControl *uiNewButton(const char *text) p.dwExStyle = 0; p.lpClassName = L"button"; + wtext = toUTF16(text); + p.lpWindowName = wtext; p.dwStyle = BS_PUSHBUTTON | WS_TABSTOP; p.hInstance = hInstance; p.onWM_COMMAND = onWM_COMMAND; @@ -81,12 +83,9 @@ uiControl *uiNewButton(const char *text) p.preferredSize = preferredSize; p.data = b; b->c = uiWindowsNewControl(&p); + uiFree(wtext); 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); b->onClicked = defaultOnClicked; diff --git a/newcontrol_windows.c b/newcontrol_windows.c index 1293f5aa..ce7bad4c 100644 --- a/newcontrol_windows.c +++ b/newcontrol_windows.c @@ -90,7 +90,7 @@ uiControl *uiWindowsNewControl(uiWindowsNewControlParams *p) c = uiNew(uiSingleHWNDControl); c->hwnd = CreateWindowExW(p->dwExStyle, - p->lpClassName, L"", + p->lpClassName, p->lpWindowName, p->dwStyle | WS_CHILD | WS_VISIBLE, 0, 0, 100, 100, diff --git a/ui_windows.h b/ui_windows.h index c86e6a95..3a4ebd95 100644 --- a/ui_windows.h +++ b/ui_windows.h @@ -13,7 +13,7 @@ struct uiWindowsNewControlParams { // These match the CreateWindowExW() function. DWORD dwExStyle; LPCWSTR lpClassName; -//TODO? LPCWSTR lpWindowName; + LPCWSTR lpWindowName; DWORD dwStyle; // WS_CHILD and WS_VISIBLE are automatically applied. HINSTANCE hInstance;