开发者

Accessing another element from custom wxPanel wxWidgets

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开发者_如何学JAVA 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?


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

void OnSpin( wxSpinEvent& event )
{
  count = event.GetPosition();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜