Help with wxTaskBarIcon

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
mr1x
Knows some wx things
Knows some wx things
Posts: 34
Joined: Mon Jan 05, 2009 3:24 am

Help with wxTaskBarIcon

Post by mr1x » Wed Apr 01, 2009 6:50 pm

I am having a problem with wxTaskBarIcon - hopefully someone could enlighten me on the proper use. The following is for Win32 platform.

I create task bar icon, which pops up a menu with handler for "Exit" function. In handler for the "exit" item I call Close() on my main application frame.
In the main application frame OnClose handler I then Remove() task bar icon.

If I call Remove(), task bar icon is removed from tray but appears to continue running. As such, the application never exits even though the main frame is destroyed (task bar icon apparently keeps running the event loop).

If I attempt to delete task bar icon object from the OnClose() handler of main frame, I get exceptions in event handling for the task bar icon popup menu. It appears that popup menu is still active and sending events while the main frame is processing OnClose(). So, I can't delete the task bar icon either.

Task bar icon also does not seem to have Destroy() method so delayed destruction is not possible.

Any help in making my application be able to use the task bar icon and still exit :) would be appreciated!

TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV » Wed Apr 01, 2009 10:48 pm

Put here relevant code, it's gonna be easyer to answer.

User avatar
doublemax
Moderator
Moderator
Posts: 15282
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Post by doublemax » Thu Apr 02, 2009 10:47 am

and maybe take a lot at how the taskbaricon sample works.
Use the source, Luke!

mr1x
Knows some wx things
Knows some wx things
Posts: 34
Joined: Mon Jan 05, 2009 3:24 am

Post by mr1x » Fri Apr 03, 2009 8:01 pm

doublemax wrote:and maybe take a lot at how the taskbaricon sample works.
It works (and crashes) the same way :)
I reported a bug to trac.

TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV » Tue Apr 07, 2009 8:55 pm

Before reporting a bug, you should have tried longer... wxWidgets is certainly not perfect (what is?) but i do trust components, especially if they are used by thousand developers, and for a long time.
Maybe is it just a misunderstanding of the way components work. Someone else could have pointed it... if only you provided some source code.

mr1x
Knows some wx things
Knows some wx things
Posts: 34
Joined: Mon Jan 05, 2009 3:24 am

Post by mr1x » Tue Apr 21, 2009 3:49 am

TrV wrote:Before reporting a bug, you should have tried longer... wxWidgets is certainly not perfect (what is?) but i do trust components, especially if they are used by thousand developers, and for a long time.
Maybe is it just a misunderstanding of the way components work. Someone else could have pointed it... if only you provided some source code.

Doing the same thing and expecting a different result. There is a saying about that, but I don't remember how that goes.

TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV » Tue Apr 21, 2009 8:33 am

mr1x wrote:Doing the same thing and expecting a different result. There is a saying about that, but I don't remember how that goes.
??? What are you talking about ?

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Tue Apr 21, 2009 3:38 pm

TrV wrote:Before reporting a bug, you should have tried longer... wxWidgets is certainly not perfect (what is?) but i do trust components, especially if they are used by thousand developers, and for a long time.
Maybe is it just a misunderstanding of the way components work. Someone else could have pointed it... if only you provided some source code.
IMO if the sample crashes, then it's a bug ;)

TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV » Tue Apr 21, 2009 5:17 pm

Sure, Auria.
Besides the fact i'm using wxTaskbar from months now and didn't point any issue, I've tested the sample.
And you know what, everything works perfectly ! :)
Damned, have i introduced a bug into the bug that make it work ? ;)

Post Reply