From ac6d0429f1befcceb94bca7ad57b19bd11afd1b6 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 20 Aug 2014 14:17:00 -0400 Subject: Implemented TextField.Invalid() on Windows. --- redo/basicctrls_windows.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'redo/basicctrls_windows.c') diff --git a/redo/basicctrls_windows.c b/redo/basicctrls_windows.c index 1676776..c82c5d6 100644 --- a/redo/basicctrls_windows.c +++ b/redo/basicctrls_windows.c @@ -104,3 +104,23 @@ void setTextFieldSubclass(HWND hwnd, void *data) if ((*fv_SetWindowSubclass)(hwnd, textfieldSubProc, 0, (DWORD_PTR) data) == FALSE) xpanic("error subclassing TextField to give it its own event handler", GetLastError()); } + +void textfieldSetAndShowInvalidBalloonTip(HWND hwnd, WCHAR *text) +{ + EDITBALLOONTIP ti; + + ZeroMemory(&ti, sizeof (EDITBALLOONTIP)); + ti.cbStruct = sizeof (EDITBALLOONTIP); + ti.pszTitle = L"Invalid Input"; // TODO verify + ti.pszText = text; + ti.ttiIcon = TTI_ERROR; + if (SendMessageW(hwnd, EM_SHOWBALLOONTIP, 0, (LPARAM) (&ti)) == FALSE) + xpanic("error showing TextField.Invalid() balloon tip", GetLastError()); + MessageBeep(0xFFFFFFFF); // TODO can this return an error? +} + +void textfieldHideInvalidBalloonTip(HWND hwnd) +{ + if (SendMessageW(hwnd, EM_HIDEBALLOONTIP, 0, 0) == FALSE) + xpanic("error hiding TextField.Invalid() balloon tip", GetLastError()); +} -- cgit v1.2.3