Tutorials Topic is solved

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
Wraithan
Earned a small fee
Earned a small fee
Posts: 17
Joined: Wed Dec 07, 2005 1:32 pm
Contact:

Tutorials

Post by Wraithan »

Out of curiousity, why is most of both out of date? I tried to find ANY tutorial for wxWidgets, and all of them are broken code. And the documentation is hard for someone newish to programming to understand. Especially when the examples don't all work.

So, if there is any tutorials that actually have functioning code, or documentation that would help someone new to GUI programming, that would be great.
benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte »

You can find few pages about wxWidgets Tutorial using google.

http://www.bzzt.net/~wxwidgets/icpp_wx1.html
http://www.codeproject.com/useritems/wxWidgets.asp

and the samples should work.
If you have any compiling/linking error message, you should post what you get so that we can help you in resolving them.
Wraithan
Earned a small fee
Earned a small fee
Posts: 17
Joined: Wed Dec 07, 2005 1:32 pm
Contact:

Post by Wraithan »

Well the first example you gave gives me this:

Code: Select all

In file included from C:/wxWidgets-2.6.2/include/wx/platform.h:258,
                 from C:/wxWidgets-2.6.2/include/wx/defs.h:21,
                 from C:/wxWidgets-2.6.2/include/wx/wx.h:15,
                 from basic.cpp:1:
C:/wxWidgets-2.6.2/include/wx/chkconf.h:92:9: #error "wxUSE_EXCEPTIONS must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:203:9: #error "wxUSE_STDPATHS must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:211:9: #error "wxUSE_XML must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:349:9: #error "wxUSE_CHOICEBOOK must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:397:9: #error "wxUSE_DATEPICKCTRL must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:405:9: #error "wxUSE_DISPLAY must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:477:9: #error "wxUSE_XRC must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:530:9: #error "wxUSE_LISTBOOK must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:578:9: #error "wxUSE_MDI must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:682:9: #error "wxUSE_SOUND must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:985:13: #error "wxZip requires wxArchive"
C:/wxWidgets-2.6.2/include/wx/chkconf.h:1450:14: #error "MDI requires wxUSE_MDI"
if I put in all the code from the first example into all the right files.

I will try the second one in a min or 2

The results of the second one

Code: Select all

In file included from C:/wxWidgets-2.6.2/include/wx/platform.h:258,
                 from C:/wxWidgets-2.6.2/include/wx/defs.h:21,
                 from C:/wxWidgets-2.6.2/include/wx/wx.h:15,
                 from main.cpp:6:
C:/wxWidgets-2.6.2/include/wx/chkconf.h:92:9: #error "wxUSE_EXCEPTIONS must be defined."

C:/wxWidgets-2.6.2/include/wx/chkconf.h:203:9: #error "wxUSE_STDPATHS must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:211:9: #error "wxUSE_XML must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:349:9: #error "wxUSE_CHOICEBOOK must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:397:9: #error "wxUSE_DATEPICKCTRL must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:405:9: #error "wxUSE_DISPLAY must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:477:9: #error "wxUSE_XRC must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:530:9: #error "wxUSE_LISTBOOK must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:578:9: #error "wxUSE_MDI must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:682:9: #error "wxUSE_SOUND must be defined."
C:/wxWidgets-2.6.2/include/wx/chkconf.h:985:13: #error "wxZip requires wxArchive"
C:/wxWidgets-2.6.2/include/wx/chkconf.h:1450:14: #error "MDI requires wxUSE_MDI"
If these errors are my fault then please point them out. All the code was directly copied and pasted from those tutorials.
Ksmith22
I live to help wx-kind
I live to help wx-kind
Posts: 199
Joined: Mon Nov 21, 2005 4:34 pm

Post by Ksmith22 »

It looks like you don't have all of the compiler settings correctly setup, but I'm not sure what you are missing.

Based on the errors, my guess is your compiler doesn't know where to find the header files. But that is just a guess based on the fact that a lot of things seem undefined (and if I'm reading the errors right the problem is with wx.h which is likely the first header loaded anyways - edit: well ok, I looked at the examples and wx.h is the only include as it is). I'm not familiar with this compiler so I can't say how to fix that, but if there is a place somewhere to setup additional include directories, that is where I would start. I could be wrong though.

P.S. - As far as the main topic goes, the samples that come with wxWidgets are very helpful as tutorials. And if you are willing to shell out some cash, the wxWidgets book is also really useful from what I've found. Sometimes it helps just to be able to see pictures of what everything does so you have a better idea before diving in. And there is a lot of example code in there too to get you started.
metalogic
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Fri Oct 08, 2004 8:21 am
Location: Area 51
Contact:

Post by metalogic »

Wraithan,
What compiler are you using?
benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte »

Did you use the .exe or the .zip distribution of wxWidgets? (AFAIK, the ZIP requires that you set up manually the WXDIR path environment variable)
How did you build the wxWidgets libraries ?


Did you build them as static or dynamic ?

I can see you are using wxMSW 2.6.2. What is your compiler ?
User avatar
T-Rex
Moderator
Moderator
Posts: 1249
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex »

have you copied setup.h from include/wx/<platform> to include/wx and do you have wxWidgets include directory in your includes path?
User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Re: Tutorials

Post by ABX »

Wraithan wrote:I tried to find ANY tutorial for wxWidgets, and all of them are broken code.
Out of curisoity, did you just placed wxWidgets source code on your drive or did you "installed". In other words which documents did you used to setup wxWidgets on your drive? Your install looks incomplete and that's from where all your problems came.

ABX
CVS Head, 2.8.X
wxMSW, wxWinCE, wxPalmOS, wxOS2, wxMGL, bakefile
gcc 3.2.3, bcc 5.51, dmc 8.48, ow 1.6, vc 7.1, evc 3/4, pods 1.2
Wraithan
Earned a small fee
Earned a small fee
Posts: 17
Joined: Wed Dec 07, 2005 1:32 pm
Contact:

Post by Wraithan »

I am was using Dev-Cpp (NOT wxDev-Cpp) with the dev packs installed and I have wxwidgets I think 2.6.2 installed on that machine(I am not at that one currently) I can compile the minimal program that is the template when you start up a wxWidgets project. I can even edit that. But when I try to run the code posted on those sites it errors out.

wxDev-Cpp locks up my machine when it tries to do anything but the template, I was using my Dev-Cpp before I tried to install wxDev-Cpp when I did those test.

I didn't copy the setup.h over because there was one already there that the dev packs put there. And I did set my directories to use the wxWidgets/includes (I verified the path and everything.
NinjaNL
Moderator
Moderator
Posts: 899
Joined: Sun Oct 03, 2004 10:33 am
Location: Oosterwolde, Netherlands

Post by NinjaNL »

Wraithan wrote:wxDev-Cpp locks up my machine when it tries to do anything but the template, I was using my Dev-Cpp before I tried to install wxDev-Cpp when I did those test.
I have mentioned this several times on this board, but once again. If you are using wxDevCpp to develop a non form derived program, (a form is what you drop your components on) then if there isn't an empty wxWidgets program template, then you have to make one. There are several threads (IIRC) where I have oulined this. In the distribution of wxDevCpp we have included almost all of the wxWidgets samples. try opening one of these project (*.dev) files, and seeing if it compiles correctly. If so then there is another problem raising its head, and we need to sort it out so that you will continue to use and hopefully enjoy the program, just as so many others are.
Wraithan wrote:I didn't copy the setup.h over because there was one already there that the dev packs put there. And I did set my directories to use the wxWidgets/includes (I verified the path and everything.
You shouldn't really need to point your directories anywhere if the devpak was set up correctly.

Generally speaking, when one installs a devpak, ALL necessary files are installed. So therefore you shouldn't need to download wxWidgets yourself IF the devpak creator has done its job correctly. If you use wxDevCpp then I have generated the DevPak being used (unless you are using an old version which has a devpak generated by upCASE.

If need be, I can email you a project where the initial tutorial benedicte mentioned (from bzzt.net) is included and working. This should allow you to see that wxDevCpp is correctly installed and working correctly. If the samples providedd are not compiling correctly, then there is a failure in your setup. Perhaps one of your other devpaks is conflicting with the my devpak, perhaps your include. lib and resource paths are incorrect.

If you wish to have both DevCpp and wxDevCpp on the same machine, then search a little on the forum, someone here outlined a method to accomplish this. I did it this way: Install DevCpp, copy the devcpp program somewhere to keep it safe. Uninstall devcpp correctly (you have to search for files devcpp.cfg and devcpp.ini if memory serves). Download and install the lates wxDevCpp beta. In the install directory, rename devcpp.exe to something like wxdevcpp.exe. copy your previously saved devcpp.exe back to the install directory. Run wxdevcpp, allow the class stuff to do its stuff, once the program is complete, close it. Run devcpp, allow the class stuff do complete. Create two shortcute on the desktop, one for wxdevcpp and the other for devcpp. All things being well, you should now be able to run both wxDevCpp AND devcpp on the same machine in the same forlder with little or no interference.
Follow the development of my screenplay authoring program at http://wxscreenplaywriter.blogspot.com/
Wraithan
Earned a small fee
Earned a small fee
Posts: 17
Joined: Wed Dec 07, 2005 1:32 pm
Contact:

Post by Wraithan »

Well, after finding the tutorial on installing both, I attempted it on my laptop. Finally I have both working and I am able to go through the tutorials and still compile and use my Dev-Cpp. I appologize for my impatience yesterday, just wasn't having a good day. I will see if I can fix the installation on my desktop at home when I get there later today.

Thank you for being patient. I have yet to try and compile wxWidgets on my regular Dev-Cpp installation. But since I have wxDev-Cpp working, it doesn't look like I will need to.

~Wraith
Post Reply