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 »

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 »

Put here relevant code, it's gonna be easyer to answer.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Post by doublemax »

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 »

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 »

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 »

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 »

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 »

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 »

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