从自定义 wxPanel wxWidgets 访问另一个元素
大家好,堆栈溢出的好心人,我在创建应用程序时遇到了一些困难。我正在使用自定义 wxPanels 来显示一些类似的东西。
我遇到的麻烦是当面板中的计数器更新时更新主计数(计数器是wxSpinCtrl的)我一生都无法找到从任何wxPanel访问主spinctrl的方法。
我尝试将指针传递给主 spinctrl,但是当我尝试从那里访问它时,出现段错误。我尝试设置自定义事件,但我不知道如何从主面板访问 wxPanel 的子级。有人有什么建议吗?
Hello good people of stack overflow, I have run into a bit of a wall in creating an application. I am using custom wxPanels to display a few similar things.
What I'm having trouble doing is updating a master count when a counter in the panel is updated (the counters are wxSpinCtrl's) I can not, for the life of me, find a way to access the master spinctrl from any of the wxPanels.
I've tried passing a pointer to the master spinctrl, but when I try to access it from there I get a seg fault. I've tried setting up a custom event, but I don't know how to access the children of a wxPanel from the main panel. Does anyone have any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过多种方式执行此操作,但通常的方法是使用用户更改旋转控制值时触发的事件。
您不需要自定义事件,提供的 wxSpinEvent 就可以了。
您不需要访问 spinccontrol,您可以从事件中获取新值
You can do this several ways, but the usual way is to use an event that is triggered when the user changes the spin control value.
You do not need a custom event, the provided wxSpinEvent is fine.
You do not need to access the spinctontrol, you can get the new value from the event