How to prevent mouse & key events for wxSplashScreen? Topic is solved

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
emarti
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 210
Joined: Sat May 07, 2005 8:24 pm
Location: Eskisehir, TURKEY
Contact:

How to prevent mouse & key events for wxSplashScreen?

Post by emarti » Tue Dec 12, 2006 9:39 am

As title...

Respectly,
emarti
- T U R K E Y ?
- I love this country!

WebSites:
http://mebt.sourceforge.net/
http://wxquran.sourceforge.net/

User avatar
Ryan Norton
Moderator
Moderator
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton » Tue Dec 12, 2006 1:53 pm

Maybe catching the relevant events and not skipping them would work. I wonder what you want to do exactly though... :D?
[Mostly retired moderator, still check in to clean up some stuff]

emarti
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 210
Joined: Sat May 07, 2005 8:24 pm
Location: Eskisehir, TURKEY
Contact:

Post by emarti » Tue Dec 12, 2006 4:01 pm

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. :) )
- T U R K E Y ?
- I love this country!

WebSites:
http://mebt.sourceforge.net/
http://wxquran.sourceforge.net/

User avatar
Ryan Norton
Moderator
Moderator
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton » Tue Dec 12, 2006 5:49 pm

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
[Mostly retired moderator, still check in to clean up some stuff]

renaud.s
Knows some wx things
Knows some wx things
Posts: 43
Joined: Wed Feb 22, 2006 9:23 pm
Location: Belgium
Contact:

Post by renaud.s » Tue Dec 12, 2006 10:10 pm

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...

emarti
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 210
Joined: Sat May 07, 2005 8:24 pm
Location: Eskisehir, TURKEY
Contact:

Post by emarti » Wed Dec 13, 2006 9:59 am

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.
- T U R K E Y ?
- I love this country!

WebSites:
http://mebt.sourceforge.net/
http://wxquran.sourceforge.net/

Post Reply