wxctrltext中事件问题求助!! Topic is solved

这是wxWidgets论坛的中文版本。在这里,您可以用您的母语汉语讨论上面任一子论坛所涉及的所有关于wxWidgets的话题。欢迎大家参与到对有价值的帖子的中英互译工作中来!
Post Reply
leonzheng1
In need of some credit
In need of some credit
Posts: 7
Joined: Thu May 08, 2014 4:10 pm

wxctrltext中事件问题求助!!

Post by leonzheng1 »

本人想问下wxctrltext中哪个事件可以在点击文本框时触发?我试过用 onchart 或者onclick 还有 getcursor 也用用过,不过没办法达到我想要的那种效果,我希望如下图
Image
在我点击用户文名文本框的时候清空文本框内的文字,当光标离开文本框的时候判断文本框是否为空如果是直接赋值为“please enter your username”。
请各位前辈大神们指点下有没有哪些可以在 connect() 或 BEGIN_EVENT_TABLE(Frame,wxFrame) end 中运行的事件? [-o< [-o<
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxctrltext中事件问题求助!!

Post by doublemax »

wxFocusEvent is what you're looking for:
http://docs.wxwidgets.org/trunk/classwx ... event.html

However, on Vista systems and higher you don't need to implement this yourself, because there is this:
http://docs.wxwidgets.org/trunk/classwx ... be83f1bed4
Use the source, Luke!
Post Reply