Talk:Writing Your First Application-Adding A Button

From WxWiki
Jump to navigation Jump to search

Sorry if this isnt the best place to put this, but copying and pasting the code from this page into dev-c++ results in the error:

14 C:\Dev-Cpp\base.cpp conversion from `const char[13]' to `const wxString' is ambiguous

replacing

"Hello World!" (inc quotes)

with

_T("Hello World!")

solves the error.

I have the devPak for wxWidgets 2.6.1 unicode, which i know isnt the latest version.
Being a comparative newb, ive just copied some one elses solution.

From here:
http://ubuntuforums.org/showthread.php?t=29228

It would appear the error comes from the fact i am using the unicode version (instead of ANSI)

similar problem here:
http://forum.gubed.mccabe.nu/viewtopic.php?t=12.

Sorry again

Compiling Error with Base.h

I'm having trouble, and I'm not sure whats causing it. I tried copy/pasting the code too, but then I realized the code had some errors in it too (that I fixed). These were simple things like & 's that were html blocks representing spaces and quot; 's n such... Anyways, the error I've had both before and after tampering is Base.h:28: error: invalid static_cast from type `void (MainFrame::*)(wxCommandEvent)' to type `void (wxEvtHandler::*)(wxCommandEvent&)'

the line 28 is EVT_BUTTON ( BUTTON_Hello, MainFrame::OnExit ) // Tell the OS to run MainFrame::OnExit when


any suggestions?

Challenge on this page

I got the challenge... But partially due to guesswork and the fact that I'd already done the tutorial where you make a text editor.... Are you meant to have to guess the EVT_TEXT and thing or are you meant to just know it by this point (same with "wxLogMessage" or anything else you can use to make the message box).... I have a feeling I'm skipping ahead if you're supposed to already know it