On Sat, 18 Jun 2022 13:24:51 +0530 Sean Mayard wrote:
SM> I am using wxTimer and i noticed that if i use the following, everything(the timer) works/fires up correctly:
SM> timer = new wxTimer(this);
SM>
SM> Bind(wxEVT_TIMER, &MyPanel::onTimer, this, timer->GetId());
SM> But when i use timer->Bind as shown below the timer doesn't fire up.
SM> timer = new wxTimer(this);
SM> timer->Bind(wxEVT_TIMER, &MyPanel::onTimer, this);
SM>
SM> Note in the latter the id of the timer is not passed as an argument
SM> because i thought that since we are explicitly binging the timer using
SM> timer->Bind so we don't need to pass the id.
SM> My question is how is that the second case doesn't work. I read here
SM> that when we don't use SetOwner then we must use Connect/Bind. But
SM> that's what I did and still the second case is not working. Why/how is
SM> that?
You did set the timer owner by passing "this" to its ctor. For the timer
itself to get its own events, you need to use its default ctor.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/