Changed onWM_COMMAND() to give our controls only the notification code. We don't want to give the control the ID part of wParam because that's (or that'll be) dynamically assigned based on control parenting and prior controls; we don't want to give the control the LPARAM since that contains the window handle and uiControl already has that.
This commit is contained in:
parent
d4271c8ceb
commit
a538412df2
|
@ -6,11 +6,11 @@ struct button {
|
||||||
void *onClickedData;
|
void *onClickedData;
|
||||||
};
|
};
|
||||||
|
|
||||||
static BOOL onWM_COMMAND(uiControl *c, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
|
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
|
||||||
{
|
{
|
||||||
struct button *b = (struct button *) (c->data);
|
struct button *b = (struct button *) (c->data);
|
||||||
|
|
||||||
if (HIWORD(wParam) != BN_CLICKED)
|
if (code != BN_CLICKED)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
(*(b->onClicked))(c, b->onClickedData);
|
(*(b->onClicked))(c, b->onClickedData);
|
||||||
*lResult = 0;
|
*lResult = 0;
|
||||||
|
|
|
@ -6,13 +6,13 @@ struct checkbox {
|
||||||
void *onToggledData;
|
void *onToggledData;
|
||||||
};
|
};
|
||||||
|
|
||||||
static BOOL onWM_COMMAND(uiControl *c, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
|
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
|
||||||
{
|
{
|
||||||
struct checkbox *cc = (struct checkbox *) (c->data);
|
struct checkbox *cc = (struct checkbox *) (c->data);
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
WPARAM check;
|
WPARAM check;
|
||||||
|
|
||||||
if (HIWORD(wParam) != BN_CLICKED)
|
if (code != BN_CLICKED)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// we didn't use BS_AUTOCHECKBOX (see controls_windows.go) so we have to manage the check state ourselves
|
// we didn't use BS_AUTOCHECKBOX (see controls_windows.go) so we have to manage the check state ourselves
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
struct entry {
|
struct entry {
|
||||||
};
|
};
|
||||||
|
|
||||||
static BOOL onWM_COMMAND(uiControl *c, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
|
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ typedef struct singleHWND singleHWND;
|
||||||
|
|
||||||
struct singleHWND {
|
struct singleHWND {
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
BOOL (*onWM_COMMAND)(uiControl *, WPARAM, LPARAM, LRESULT *);
|
BOOL (*onWM_COMMAND)(uiControl *, WORD, LRESULT *);
|
||||||
BOOL (*onWM_NOTIFY)(uiControl *, WPARAM, LPARAM, LRESULT *);
|
BOOL (*onWM_NOTIFY)(uiControl *, WPARAM, LPARAM, LRESULT *);
|
||||||
void (*onWM_DESTROY)(uiControl *);
|
void (*onWM_DESTROY)(uiControl *);
|
||||||
uintptr_t parent;
|
uintptr_t parent;
|
||||||
|
@ -65,7 +65,7 @@ static LRESULT CALLBACK singleSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
|
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case msgCOMMAND:
|
case msgCOMMAND:
|
||||||
if ((*(s->onWM_COMMAND))(c, wParam, lParam, &lResult) != FALSE)
|
if ((*(s->onWM_COMMAND))(c, HIWORD(wParam), &lResult) != FALSE)
|
||||||
return lResult;
|
return lResult;
|
||||||
break;
|
break;
|
||||||
case msgNOTIFY:
|
case msgNOTIFY:
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct uiWindowsNewControlParams {
|
||||||
// Store the result in *lResult and return any non-FALSE value (such as TRUE) to return the given result; return FALSE to pass the notification up to your window procedure.
|
// Store the result in *lResult and return any non-FALSE value (such as TRUE) to return the given result; return FALSE to pass the notification up to your window procedure.
|
||||||
// Note that these are only issued if they come from the uiControl itself; notifications from children of the uiControl (such as a header control) will be received normally.
|
// Note that these are only issued if they come from the uiControl itself; notifications from children of the uiControl (such as a header control) will be received normally.
|
||||||
// TODO don't give WPARAM/LPARAM raw
|
// TODO don't give WPARAM/LPARAM raw
|
||||||
BOOL (*onWM_COMMAND)(uiControl *c, WPARAM wParam, LPARAM lParam, LRESULT *lResult);
|
BOOL (*onWM_COMMAND)(uiControl *c, WORD code, LRESULT *lResult);
|
||||||
BOOL (*onWM_NOTIFY)(uiControl *c, WPARAM wParam, LPARAM lParam, LRESULT *lResult);
|
BOOL (*onWM_NOTIFY)(uiControl *c, WPARAM wParam, LPARAM lParam, LRESULT *lResult);
|
||||||
// This is called in WM_DESTROY.
|
// This is called in WM_DESTROY.
|
||||||
void (*onWM_DESTROY)(uiControl *c);
|
void (*onWM_DESTROY)(uiControl *c);
|
||||||
|
|
Loading…
Reference in New Issue