From 5fc368fc23f0720fc193883d0709df8417268987 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 5 Nov 2014 12:59:44 -0500 Subject: Started adding TextField.ReadOnly() and implemented it (mostly) on Windows. --- basicctrls_windows.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'basicctrls_windows.c') diff --git a/basicctrls_windows.c b/basicctrls_windows.c index 4cda2eb..b33bce2 100644 --- a/basicctrls_windows.c +++ b/basicctrls_windows.c @@ -128,6 +128,19 @@ void textfieldHideInvalidBalloonTip(HWND hwnd) xpanic("error hiding TextField.Invalid() balloon tip", GetLastError()); } +// also good for Textbox +int textfieldReadOnly(HWND hwnd) +{ + return (GetWindowLongPtrW(hwnd, GWL_STYLE) & ES_READONLY) != 0; +} + +// also good for Textbox +void textfieldSetReadOnly(HWND hwnd, BOOL readonly) +{ + if (SendMessageW(hwnd, EM_SETREADONLY, (WPARAM) readonly, 0) == 0) + xpanic("error setting TextField/Textbox as read-only/not read-only", GetLastError()); +} + static LRESULT CALLBACK groupSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR data) { LRESULT lResult; -- cgit v1.2.3