- Code samples中的各个网页内容学习并记录
一内容概括
1、给ChildWin添加通告消息。
二、给ChildWin添加通告消息
MyGui中的消息响应类似C#中的委托机制,具体怎么实现的还没有研究。现在主要着眼于使用MyGui。
1、在ChildWin类中添加成员变量
MyGUI::delegates::CDelegate2<MyGUI::Widget*,size_t> eventAction;
2、添加代码void ChildWin::notifyMouseButtonClick(MyGUI::Widget* _sender) { eventAction(_sender,0);//发送事件 }
3、添加委托void DemoKeeper::createScene() { //略…… mHelloWord = new HelloWord();//创建对话框 mChildWin = new ChildWin(mHelloWord->getView());//创建对话框2 mChildWin->getView()->setPosition(20,50); mChildWin->eventAction = MyGUI::newDelegate(this, &DemoKeeper::notifyEventAction); }
4、事件处理函数
void DemoKeeper::notifyEventAction(MyGUI::Widget* _sender, size_t _index ) { //处理通告消息 }
可以在DemoKeeper中获得并响应ChildWin中按钮按下的消息了。
MyGUI 学习笔记(二)——MyGUI sample2——13.01.23
最新推荐文章于 2015-08-30 19:44:56 发布