Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Counting number of instances of wxSplashScreen

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Counting number of instances of wxSplashScreen
#3406
Posted by: 2004-02-25 03:47:12
I decided to use a splash screen as my About for my program (because I thought it would be easiest), and the code looks like this:

SplashAbout = new wxSplashScreen(IMG_About,
    wxSPLASH_CENTRE_ON_SCREEN|wxSTAY_ON_TOP,
    -1,
    this,
    SPLASH_About,
    wxDefaultPosition,
    wxDefaultSize,
    wxSIMPLE_BORDER|wxSTAY_ON_TOP);

When the user clicks the 'About' button, the splash screen opens.  All good... until the user clicks the 'About' button again while the splash screen is open and it opens another splash screen, then I have multiples of the same splash screen open!  Is there a way to disable the use of the main window, or somehow check if there is already an open instance of the splash screen and have it close it?

Thanks
Message2. Re: Counting number of instances of wxSplashScreen
#3417
Posted by: upCASE 2004-02-26 15:19:14
Hi!
Well, I guess using the "normal" splashscreen class you'llbe out of luck. You'd have to set something like a modal style flag, but this doesn't seem to work.
My solutions would be:
1. Use a dialog instead and show it modal so that the app itself doesn't recive any input. Maybe use a timer and automatically close the dialog after a certain time.
2. Derive your own class from wxSplashscreen and implement it as a singleton. But sure to initialize all pointers properly.

upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message3. Re: Counting number of instances of wxSplashScreen
#3424
Posted by: 2004-02-27 09:45:38
K, sounds good, Ill try that

Thanks
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Tue 2024-12-10  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0