Started the work for Spinbox.OnChanged() on Windows with the edit control.
This commit is contained in:
parent
280723763c
commit
8f04623115
|
@ -210,3 +210,29 @@ HWND newUpDown(HWND prevUpDown, void *data)
|
|||
xpanic("error subclassing Spinbox up-down control to give it its own event handler", GetLastError());
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK spinboxEditSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR data)
|
||||
{
|
||||
switch (uMsg) {
|
||||
case msgCOMMAND:
|
||||
if (HIWORD(wParam) == EN_CHANGE) {
|
||||
spinboxEditChanged((void *) data);
|
||||
return 0;
|
||||
}
|
||||
return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam);
|
||||
case WM_NCDESTROY:
|
||||
if ((*fv_RemoveWindowSubclass)(hwnd, spinboxEditSubProc, id) == FALSE)
|
||||
xpanic("error removing Spinbox edit control subclass (which was for its own event handler)", GetLastError());
|
||||
return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam);
|
||||
default:
|
||||
return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
xmissedmsg("Spinbox edit control", "spinboxEditSubProc()", uMsg);
|
||||
return 0; // unreached
|
||||
}
|
||||
|
||||
void setSpinboxEditSubclass(HWND hwnd, void *data)
|
||||
{
|
||||
if ((*fv_SetWindowSubclass)(hwnd, spinboxEditSubProc, 0, (DWORD_PTR) data) == FALSE)
|
||||
xpanic("error subclassing Spinbox edit control to give it its own event handler", GetLastError());
|
||||
}
|
|
@ -35,6 +35,7 @@ func newSpinbox(min int, max int) Spinbox {
|
|||
s.max = max
|
||||
s.value = s.min
|
||||
s.remakeUpDown()
|
||||
C.setSpinboxEditSubclass(s.hwndEdit, unsafe.Pointer(s))
|
||||
return s
|
||||
}
|
||||
|
||||
|
@ -73,6 +74,13 @@ func spinboxUpDownClicked(data unsafe.Pointer, nud *C.NMUPDOWN) {
|
|||
s.changed.fire()
|
||||
}
|
||||
|
||||
//export spinboxEditChanged
|
||||
func spinboxEditChanged(data unsafe.Pointer) {
|
||||
s := (*spinbox)(unsafe.Pointer(data))
|
||||
// TODO
|
||||
s.changed.fire()
|
||||
}
|
||||
|
||||
func (s *spinbox) setParent(p *controlParent) {
|
||||
C.controlSetParent(s.hwndEdit, p.hwnd)
|
||||
C.controlSetParent(s.hwndUpDown, p.hwnd)
|
||||
|
|
|
@ -76,6 +76,7 @@ extern void textfieldSetAndShowInvalidBalloonTip(HWND, WCHAR *);
|
|||
extern void textfieldHideInvalidBalloonTip(HWND);
|
||||
extern void setGroupSubclass(HWND, void *);
|
||||
extern HWND newUpDown(HWND, void *);
|
||||
extern void setSpinboxEditSubclass(HWND, void *);
|
||||
|
||||
// init_windows.c
|
||||
extern HINSTANCE hInstance;
|
||||
|
|
Loading…
Reference in New Issue