在basic_form.h文件中我定义了两个私有的全局变量,用来承载三个控件,分别是两个button和一个label
在initWindow方法中赋值:
initwindow的第一行版绑定了当前窗体的所有click事件到OnClick函数。
onClick函数定义如下:
这样我按下一个按钮,label的text就被重新设置。
这是一个非常简单的捕获UI操作然后做响应的回调操作。
关于事件,在下面的文件中有定义
//定义所有消息类型
enum EventType
{
kEventInternalDoubleClick,
kEventInternalMenu,
kEventInternalSetFocus,
kEventInternalKillFocus ,
kEventNone,
kEventFirst,
kEventAll,
kEventKeyBegin,
kEventKeyDown,
kEventKeyUp,
kEventChar,
kEventSystemKey,
kEventKeyEnd,
kEventMouseBegin,
kEventMouseMove,
kEventMouseEnter,
kEventMouseLeave,
kEventMouseHover,
kEventMouseButtonDown,
kEventMouseButtonUp,
kEventMouseRightButtonDown,
kEventMouseRightButtonUp,
kEventMouseDoubleClick,
kEventMouseMenu,
kEventMouseScrollWheel,
kEventMouseEnd,
kEventTouchBegin,
kEventTouchDown,
kEventTouchMove,
kEventTouchUp,
kEventTouchEnd,
kEventPointBegin,
kEventPointDown,
kEventPointMove,
kEventPointUp,
kEventPointEnd,
kEventSetFocus,
kEventKillFocus,
kEventWindowSize,
kEventWindowClose,
kEventSetCursor,
kEventClick,
kEventSelect,
kEventUnSelect,
kEventTextChange,
kEventReturn,
kEventTab,
kEventCustomLinkClick,
kEventImeStartComposition,
kEventImeEndComposition,
kEventScrollChange,
kEventValueChange,
kEventResize,
kEventNotify, //仅作简单的通知,有复杂数据请通过其他方式实现
kEventLast,
};