S
silenius
hi
with the compact framework 2
The only event which is fired by buttonbase, or button is the onclick event.
when I used the reflector on it I notice a mistake in the code of the button
base:
this is the microsoft code:
internal override PAL_ERROR WnProc(WM wm, int wParam, int lParam)
{
PAL_ERROR pal_error1 = 0;
WM wm1 = wm;
if (wm1 == WM.WM_BUTTON_NOTIFYCLICKED)
{
this.OnClick(new EventArgs());
pal_error1 = 0x1001;
}
if (pal_error1 == null)
{
pal_error1 = base.WnProc(wm, wParam, lParam);
}
return pal_error1;
}
i think the right code should have been:
internal override PAL_ERROR WnProc(WM wm, int wParam, int lParam)
{
PAL_ERROR pal_error1 = 0;
WM wm1 = wm;
if (wm1 == WM.WM_BUTTON_NOTIFYCLICKED)
{
this.OnClick(new EventArgs());
pal_error1 = 0x1001;
}
// 0 instead of null on the following line
if (pal_error1 == 0)
{
pal_error1 = base.WnProc(wm, wParam, lParam);
}
return pal_error1;
}
best one would have been (but maybe it is against code guideline of
microsoft) :
internal override PAL_ERROR WnProc(WM wm, int wParam, int lParam)
{
if (wm == WM.WM_BUTTON_NOTIFYCLICKED)
{
this.OnClick(new EventArgs());
return 0x1001;
}
else
{
return base.WnProc(wm, wParam, lParam);
}
}
for now on we just create our own button derivating the control
with the compact framework 2
The only event which is fired by buttonbase, or button is the onclick event.
when I used the reflector on it I notice a mistake in the code of the button
base:
this is the microsoft code:
internal override PAL_ERROR WnProc(WM wm, int wParam, int lParam)
{
PAL_ERROR pal_error1 = 0;
WM wm1 = wm;
if (wm1 == WM.WM_BUTTON_NOTIFYCLICKED)
{
this.OnClick(new EventArgs());
pal_error1 = 0x1001;
}
if (pal_error1 == null)
{
pal_error1 = base.WnProc(wm, wParam, lParam);
}
return pal_error1;
}
i think the right code should have been:
internal override PAL_ERROR WnProc(WM wm, int wParam, int lParam)
{
PAL_ERROR pal_error1 = 0;
WM wm1 = wm;
if (wm1 == WM.WM_BUTTON_NOTIFYCLICKED)
{
this.OnClick(new EventArgs());
pal_error1 = 0x1001;
}
// 0 instead of null on the following line
if (pal_error1 == 0)
{
pal_error1 = base.WnProc(wm, wParam, lParam);
}
return pal_error1;
}
best one would have been (but maybe it is against code guideline of
microsoft) :
internal override PAL_ERROR WnProc(WM wm, int wParam, int lParam)
{
if (wm == WM.WM_BUTTON_NOTIFYCLICKED)
{
this.OnClick(new EventArgs());
return 0x1001;
}
else
{
return base.WnProc(wm, wParam, lParam);
}
}
for now on we just create our own button derivating the control