Hi Huub,

From: "Huub Peters" <[EMAIL PROTECTED]>> Octavian Rasnita wrote:
Hi,

I try to close the aplication using the system tray but anything I do, it doesn't seem to work.
I put the sample app I've made in this message below.

The problem is that when I click on the tray icon, instead of closing the app, it pops up a perl interpreter error window.

If I use just

$self->Destroy;

in the event handler for that event, the application seems to be closed, but the system tray icon remains, and the program doesn't really close. In this case it doesn't give any error window.
If I use

$self->Close;

and in the EVT_CLOSE event handler I also destroy the tray icon, it appear that error window.

I've searched on the internet for this error and I found a few discussions, but I haven't seen any solution.

Am I doing something wrong? Or there is no solution of closing a WxPerl app using Wx::TaskBarIcon?

Ah yes, the good old system tray issues. I've been fighting with that a few years ago too. I've been experimenting with that a lot and my best guess is that it doesn't like the taskbaricon (object) being destroyed in it's own event handler.

I also thought that, but I don't know how to solve it.

What I've done in my case is just use a Popup menu and exit from there. Maybe that is a usable solution for you to.

Yes it could be. I've made just a short sample program, but the real program uses a menu with more options and one of them is Exit. Another menu item should be used for showing the app and moving the focus to a certain object, but I can't do that either.

I altered your code to a working sample using a right click popup menu and attached it below.

I have tried your code, but it gives the same error window after choosing the "Exit" menu item:

Perl Command Line Interpreter
Perl Command Line Interpreter has encountered a problem and needs to close. We are sorry for the inconvenience. If you were in the middle of something, the information you were working on might be lost.
For more information about this error, click here.
Debug Close

Could it be something wrong with my perl or WxPerl?

I use:

This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 50 registered patches, see perl -V for more detail)
Copyright 1987-2006, Larry Wall
Binary build 820 [274739] provided by ActiveState http://www.ActiveState.com

and Wx version 0.85

On a curious side note: does your lack of indenting your code have anything to do with you using a screenreader?
Or is this just a quick dirty hack.

Oh yes, sorry. I prefer to write the code this way because when using a screen reader without a braille display the indentation creates only disadvantages.

For example when I hit the "home" key to move the cursor to the beginning of the line, I don't need to move it back to the start of the text on that line And I can't see, so I might indent the code badly by mistake, making it harder to understand even for the sighted.

When I was sighted I use to indent the code always, no matter how small or big was the program.

Thank you.

Octavian

Reply via email to