Page 1 of 1

How to prevent mouse & key events for wxSplashScreen?

Posted: Tue Dec 12, 2006 9:39 am
by emarti
As title...

Respectly,
emarti

Posted: Tue Dec 12, 2006 1:53 pm
by Ryan Norton
Maybe catching the relevant events and not skipping them would work. I wonder what you want to do exactly though... :D?

Posted: Tue Dec 12, 2006 4:01 pm
by emarti
Hi,
I wanna do that....

My project is using wxSplashScreen & wxMediaCtrl. After splash screen displayed & media file played, I wanna created wxFrame.
I create wxFrame in EVT_MEDIA_FINISHED not wxApp::OnInit(void). Everything is OK but while application starting, when I click on splash screen (or press any key), project halts.

In wxSplashScreen,I wanna prevent key & mouse events. How to do? I can do it without using wxSplashScreen ( but I have to use it. :) )

Posted: Tue Dec 12, 2006 5:49 pm
by Ryan Norton
Try stealing events from the wxSplashScreen by directly Connect() to it.

The key here is in src/generic/splash.cpp

Code: Select all

void wxSplashScreenWindow::OnMouseEvent(wxMouseEvent& event)
{
    if (event.LeftDown() || event.RightDown())
        GetParent()->Close(true);
}
Just prevent that via

Code: Select all

mysplash->Connect(-1, wxEVT_LEFT_DOWN, 
                              wxMouseEventHandler(wxMySplash::OnMouse));
mysplash->Connect(-1, wxEVT_RIGHT_DOWN, 
                              wxMouseEventHandler(wxMySplash::OnMouse));
where

Code: Select all

void wxMySplash::OnMouse(wxMouseEvent& e)
{
}
it is kind of nefarious but it'll probably work :D:D:D

Posted: Tue Dec 12, 2006 10:10 pm
by renaud.s
Hi,

As someone suggest me a few time ago...
You may perhaps use:

int wxApp::FilterEvent(wxEvent& event)


http://www.wxwidgets.org/manuals/2.6.3/ ... ilterevent

Bye...

Posted: Wed Dec 13, 2006 9:59 am
by emarti
In wxWidgets source ($WXWIN\include\generic\splash.h & $WXWIN\src\generic\splash.cpp), when I removed or remarked lines that releationship key & mouse events, it is OK!. Of course, you have to build wxWidgets library again. But this way is not legal, I think. Is it legal?

In fact, if I select this way, the problem occurs to compile & share source code.