Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Unable to add image handler

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

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Unable to add image handler
#3321
Posted by: 2004-02-07 02:10:53
I have been unable to successfully add an image handler.  I'm sure it isn't that difficult, but I just cant seem to get it to work.

This is the code I've been trying to compile:

bool MainApp::OnInit()
{
wxImage Pic_Splash; // Create an image variable

Pic_Splash.AddHandler(wxGIFHandler);

if (Pic_Splash.LoadFile("bitmaps\\splash.gif", wxBITMAP_TYPE_GIF)) // If the bitmap loads, show the splash screen
{
      new wxSplashScreen(Pic_Splash,
          wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
          6000, NULL, -1, wxDefaultPosition, wxDefaultSize,
          wxSIMPLE_BORDER|wxSTAY_ON_TOP);
}
// Create the window
MainFrame *MainWin = new MainFrame("BlakkCount", wxPoint(1, 1),
wxSize(290, 190)); // Create an instance of our frame, or window
MainWin->Show(TRUE); // show the window
SetTopWindow(MainWin);// and finally, set it as the main window

return TRUE;
}
Thanks in advance

Message2. Re: Unable to add image handler
#3323
Posted by: KaReL 2004-02-07 03:41:50
what does (doesn't) it do?

------------------------
Website: www.KaReLs0ft.be
Message3. Re: Unable to add image handler
#3325
Posted by: 2004-02-07 06:51:42
Dev-C++ gives a "parse error before ')'" on the line with
 Pic_Splash.AddHandler(wxGIFHandler); 
Message4. Re: Unable to add image handler
#3330
Posted by: upCASE 2004-02-08 04:52:00
Hi!
1. Be sure to have <wx/image.h> image included, so that gcc won't complain about that parse error (normally this points to some unknown class name).
2. Use  Pic_Splash.AddHandler(new wxGIFHandler);, because the parameter should be a pointer to an image handler.

upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message5. Thanks
#3333
Posted by: 2004-02-09 09:11:39
Thanks a lot man
Message6. Re: Unable to add image handler
#3373
Posted by: 2004-02-15 04:05:38
it's really just a simple mistake, you have an extra ")" in your line "wxSize(290, 190);"  It shows the parse error where it is because it's the first line in your code with a "(". Just a simple typo.BlakkSyn wrote:

> I have been unable to successfully add an image handler.  I'm
> sure it isn't that difficult, but I just cant seem to get it to
> work.
>
> This is the code I've been trying to compile:
>
>

> bool MainApp::OnInit()
> {
> wxImage Pic_Splash; // Create an image variable
> 
> Pic_Splash.AddHandler(wxGIFHandler);
> 
> if (Pic_Splash.LoadFile("bitmaps\\splash.gif",
> wxBITMAP_TYPE_GIF)) // If the bitmap loads, show the splash
> screen
> {
>       new wxSplashScreen(Pic_Splash,
>           wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
>           6000, NULL, -1, wxDefaultPosition, wxDefaultSize,
>           wxSIMPLE_BORDER|wxSTAY_ON_TOP);
> }
> // Create the window
> MainFrame *MainWin = new MainFrame("BlakkCount", wxPoint(1, 1),
> wxSize(290, 190)); // Create an instance of our frame, or
> window
> MainWin->Show(TRUE); // show the window
> SetTopWindow(MainWin);// and finally, set it as the main window
> 
> return TRUE;
> }
> 

>
> Thanks in advance
>
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2024-4-20  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0