Discussion:
FlashWindow ?
Bogusław Brandys
2004-08-30 11:19:09 UTC
Permalink
Hello,

Is there any FlashWindow multiplatform in wxWidgets ?
FlashWindow in Windows just flashes current visible program window makeing
it repatedly on top and bacground for a while and beeps throught speaker.
this is fine way to alert about background errors which are supposed to
not broke program flow but user should be mentioned about it.

How to make it multiplatform (I'm interested in Windows /Linux version
only)?
Another question is threads related: I want to log errors to a file but
also to show it using standard wxLogGui in main thread. But in working
thread all errors should be only logged to a file and flash main window. I
suppose i must use something to send message to main window and use
wxLogChain to suspend messages to wxLogGui in that case , right ? Any
example ?
When is default wxLogGui created ? Can I put something like that in my
wxApp::OnInit():

wxString LogPath = AppPath + "/log/" + datf + ".txt";
m_pLogFile = fopen( LogPath.c_str(), "a+" );
wxLog::SetActiveTarget(new wxLogStderr(m_pLogFile));
chain = new wxLogChain(new wxLogGui);
wxLog::SetLogLevel(wxLOG_Message);

to change creation order ? What about default wxLogGui class in this case
: is created or no ?

I appreciate any answer.
--
Best Regards
Bogusław Brandys
Bogusław Brandys
2004-08-31 11:23:01 UTC
Permalink
Post by Bogusław Brandys
Hello,
Is there any FlashWindow multiplatform in wxWidgets ?
FlashWindow in Windows just flashes current visible program window
makeing it repatedly on top and bacground for a while and beeps throught
speaker. this is fine way to alert about background errors which are
supposed to not broke program flow but user should be mentioned about it.
How to make it multiplatform (I'm interested in Windows /Linux version
only)?
Another question is threads related: I want to log errors to a file but
also to show it using standard wxLogGui in main thread. But in working
thread all errors should be only logged to a file and flash main window.
I suppose i must use something to send message to main window and use
wxLogChain to suspend messages to wxLogGui in that case , right ? Any
example ?
When is default wxLogGui created ? Can I put something like that in my
wxString LogPath = AppPath + "/log/" + datf + ".txt";
m_pLogFile = fopen( LogPath.c_str(), "a+" );
wxLog::SetActiveTarget(new wxLogStderr(m_pLogFile));
chain = new wxLogChain(new wxLogGui);
wxLog::SetLogLevel(wxLOG_Message);
to change creation order ? What about default wxLogGui class in this
case : is created or no ?
I appreciate any answer.
--
Best Regards
Bogusław Brandys
Vadim Zeitlin
2004-08-31 22:35:28 UTC
Permalink
On Mon, 30 Aug 2004 13:19:09 +0200 Bogusław Brandys <***@o2.pl> wrote:

BB> Is there any FlashWindow multiplatform in wxWidgets ?

No, although it would be nice to have. Under Windows it is trivial, of
course, and under Mac OS X it is probably not too difficult to make the
dock icon bounce (is it?).

BB> How to make it multiplatform (I'm interested in Windows /Linux version
BB> only)?

I have no idea what can you do under Linux however. If there is nothing
about it at freedesktop.org, chances are that you can't do anything.


BB> Another question is threads related:

It's better to ask a single question per message as otherwise half of your
questions usually get lost... I'll answer to the 2nd part under separate
subject.

Regards,
VZ
David Elliott
2004-09-01 01:48:08 UTC
Permalink
Post by Vadim Zeitlin
BB> Is there any FlashWindow multiplatform in wxWidgets ?
No, although it would be nice to have. Under Windows it is trivial, of
course, and under Mac OS X it is probably not too difficult to make the
dock icon bounce (is it?).
Cocoa:

[[NSApplication sharedApplication]
requestUserAttention:NSInformationalRequest]

or NSCriticalRequest

Note that here you are conceptually flashing the application icon
rather than a particular window but I think the best thing to do is put
this functionality in wxTopLevelWindow and also in wxApp. On Windows
calling the wxApp method will find the frontmost window and call its
method, on Mac calling the wxTopLevelWindow function will call wxApp's
method.

That way the application programmer looking for the Windows behavior
gets a reasonable behavior on Mac and vice-versa.

-Dave
Vadim Zeitlin
2004-09-07 20:47:56 UTC
Permalink
On Tue, 31 Aug 2004 21:48:08 -0400 David Elliott <***@stcnet.com> wrote:

DE> > No, although it would be nice to have. Under Windows it is trivial, of
DE> > course, and under Mac OS X it is probably not too difficult to make the
DE> > dock icon bounce (is it?).
DE> >
DE> Cocoa:
DE>
DE> [[NSApplication sharedApplication]
DE> requestUserAttention:NSInformationalRequest]
DE>
DE> or NSCriticalRequest

As I said, this is quite simple to do under Windows, so instead of adding
this to the end of my never ending TODO, I just went ahead and added a
wxTLW::RequestUserAttention(). Please implement it for Mac when you have
time (and don't forget to update the docs which state that this is
MSW-only).

DE> Note that here you are conceptually flashing the application icon
DE> rather than a particular window but I think the best thing to do is put
DE> this functionality in wxTopLevelWindow and also in wxApp.

I don't think it belongs to wxApp, there are already too many things there
and calling GetTopWindow() is not that difficult.

DE> That way the application programmer looking for the Windows behavior
DE> gets a reasonable behavior on Mac and vice-versa.

I think currently it will work as well, if you call the TLW version it
will correctly on both Windows and Mac (well, once it's implemented on the
latter), won't it?

Regards,
VZ

Vadim Zeitlin
2004-08-31 22:37:57 UTC
Permalink
On Mon, 30 Aug 2004 13:19:09 +0200 Bogusław Brandys <***@o2.pl> wrote:

BB> Another question is threads related: I want to log errors to a file but
BB> also to show it using standard wxLogGui in main thread. But in working
BB> thread all errors should be only logged to a file and flash main window. I
BB> suppose i must use something to send message to main window and use
BB> wxLogChain to suspend messages to wxLogGui in that case , right ?

This is not really supported by wxLog... It doesn't distinguish the
messages by their origin, i.e. it doesn't know, nor care, whether it comes
from the main thread or not and so can't treat it differently. The only
thing I see is to use a custom log level for the messages from threads and
treat them differently.

BB> When is default wxLogGui created ?

It's created on demand and you can call wxLog::SetActiveTarget() yourself
to force the issue.

Regards,
VZ
Loading...