Showing posts with label wxwidgets. Show all posts
Showing posts with label wxwidgets. Show all posts

Tuesday, October 13, 2009

wxwidgets screenshot


wxWidgets wxMemoryDC

wxScreenDC dcScreen;
wxCoord screenWidth, screenHeight;
dcScreen.GetSize(&screenWidth, &screenHeight);
wxBitmap screenshot(screenWidth, screenHeight,-1);
wxMemoryDC memDC;
memDC.SelectObject(screenshot);
memDC.Blit( 0, 0, screenWidth, screenHeight, &dcScreen, 0, 0);
memDC.SelectObject(wxNullBitmap);

http://trac.wxwidgets.org/ticket/11007






source(s): http://www.source.com

Thursday, September 03, 2009

modification to zetcode tutorial

wxwidgets tutorial at
http://zetcode.com/tutorials/wxwidgetstutorial/menustoolbars/

has the line
wxBitmap exit(wxT("exit.png"));


I get the error in a windows compiler
"failed in wxToolbar::Realize(): invalid tool button bitmap"

the fix:
replace that line with
wxImage exitimage(wxT("exit.png"), wxBITMAP_TYPE_PNG);
wxBitmap exit(exitimage);



note:
don't forget to include #include
and call wxInitAllImageHandlers(); in your app init

wx widgets icon for your app

in windows build a file call main.rc with the following contents:


aaaaaaaaaaaaaaaa ICON "application_icon.ico"
application_icon ICON "application_icon.ico"
#define wxUSE_NO_MANIFEST 1
// set this to 1 if you don't want to
// use manifest resource (manifest resource
// is needed to enable visual styles on
// Windows XP - see docs/msw/winxp.txt
// for more information)
#include <wx/msw/wx.rc>


the windows compiler sets the first icon to be the .exe icon... and the 2nd is referenced in the code:


Then in your Frame constructor

#if !defined(__WXMSW__) && !defined(__WXPM__)
#include "application_icon.xpm"
#endif
SimpleMenu::SimpleMenu(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(280, 180))
{

SetIcon( wxICON( application_icon ) );
...


you can use gimp to build your xpm and and ico files. If you rename your xpm file at all... edit it with a text editor and make sure the c string in it reads:
application_icon_xpm if the filename is application_icon.xpm

wxWidgets - rc file "wx/msw/wx.rc" not found

using visual studio express 2008
with an .rc file that has:
#include "wx/msw/wx.rc"

Error: "wx/msw/wx.rc" not found

the fix:
Even though you have already set the include path for your whole project to include wxwidgets... you need to set the include path again for the .rc file. Select main.rc... go up to project properties and you will see a smaller menu, and a place to put the Include path again.

wxWidgets - No Image Handler Defined

wxWidgets

Error: No Image Handler Defined

the fix:
wxInitAllImageHandlers();