Author Topic: New to Code Blocks  (Read 25457 times)

DaveK

  • Guest
New to Code Blocks
« on: July 19, 2006, 03:10:45 am »
Funny I would have thought a search for my question would have brought up a few results but I must one of the few people who doesn't have a clue. I need assistance with coding in Code::Blocks. That is if there is a book, online tutorials, or anything that can walk me through a few of the nuances of Code::Blocks. For instance, how to create an MDI, SDI, Graphics, dialog boxes, window views such as form view, dialog views, scroll views, etc.,

Thanks!

sethjackson

  • Guest
Re: New to Code Blocks
« Reply #1 on: July 19, 2006, 03:15:22 am »
Funny I would have thought a search for my question would have brought up a few results but I must one of the few people who doesn't have a clue. I need assistance with coding in Code::Blocks. That is if there is a book, online tutorials, or anything that can walk me through a few of the nuances of Code::Blocks. For instance, how to create an MDI, SDI, Graphics, dialog boxes, window views such as form view, dialog views, scroll views, etc.,

Thanks!

Ok you need coding tutorials or..... If you want to make GUI programs that are cross-platform just use some GUI toolkit (pick your poison). However if you only code for Windows just use the Windows API. I'm really not sure what you need/are asking?????

Offline kidmosey

  • Multiple posting newcomer
  • *
  • Posts: 95
    • MUSITU International
Re: New to Code Blocks
« Reply #2 on: July 19, 2006, 03:44:54 am »
I suggest reading some windows api and programming tutorials.  I make frequent trips to the MSDN library while coding straight win32.  In addition, you can find some makefile tutorials to get an idea of how targets and such work.

If you just want to create simple windows and dialog interfaces, wxWidgets is relatively easy to learn, but hides much of the internals from you, so using it for anything beyond wx is not too easy.

But it really all depends on the extent of your present knowledge and what you are wanting to develop.  You might consider creating a new project and/or design specs and working from there.  You can develop more detailed and specific questions that way instead of the general "how do I program?".  This will help you both in posting to forums and in search engines.
3 years until google knows more than god.

DaveK

  • Guest
Re: New to Code Blocks
« Reply #3 on: July 19, 2006, 12:46:20 pm »
I believe the confusing question stems from the fact I misinterpreted Code::Blocks. I thought it was a Development Studio with its own framework which created cross-platform applications in C++ when actually it's just the Development Studio which supports other frameworks. I come from a .NET framework programming background and have zero experience in coding in pure Ansi C++ for Cross platform support. I have thinking Code::Blocks was like the cross-platform solution like Visual Studio is for Window applications. When I asked about a book, that was what I was asking about. My fault for misinterpreting this application. [;)]

So I'm still back to square one, however wxWidgets proves interesting. The application I plan to create is mostly a database application. With VC++ I used ADO to access a JET database. Not sure if wxWidgets will help on this. I think for me it's a question of figuring out how to code in C++ without .NET. But the nice thing about .NET was that it had many routines that performed complex tasks for you. The problem with .NET is that most of the routines worked in Windows only. I want to move away from that and create cross-platform applications. My requirements are database access, window based application containing menus, toolbars, dialog bars, wizards, etc.

sethjackson

  • Guest
Re: New to Code Blocks
« Reply #4 on: July 19, 2006, 01:44:17 pm »
...

My requirements are database access, window based application containing menus, toolbars, dialog bars, wizards, etc.

wxWidgets can do all of this out of the box. However for database access you will need to get one of the addon classes. From wxCode.

takeshimiya

  • Guest
Re: New to Code Blocks
« Reply #5 on: July 20, 2006, 12:03:25 am »
I have thinking Code::Blocks was like the cross-platform solution like Visual Studio is for Window applications. When I asked about a book, that was what I was asking about. My fault for misinterpreting this application. [;)]
In that sense you was right. C::B with wxSmith can be thought as a kind of Visual Studio.

...

My requirements are database access, window based application containing menus, toolbars, dialog bars, wizards, etc.

wxWidgets can do all of this out of the box. However for database access you will need to get one of the addon classes. From wxCode.

Right, you can do all of that with wxWidgets.
If one wants to do GUI programming with wxWidgets, C::B includes the plugin called wxSmith which will help you to create visually forms, dialogs, etc.
To learn programming with wxWidgets, I recommend the official book.
You can download it from here: http://www.phptr.com/content/images/0131473816/downloads/0131473816_book.pdf

That book, along with wxWidgets, wxSmith, the wxWidgets reference manual, and Code::Blocks, will get you going with all the development you wanted to do, and in a cross-platform way.

Offline iw2nhl

  • Multiple posting newcomer
  • *
  • Posts: 116
  • BASIC, C, C++, Qt, bash
Re: New to Code Blocks
« Reply #6 on: July 20, 2006, 01:03:13 am »
Another great cross-platform C++ toolkit is Qt.
It works on Windows (95 to Vista), Linux, Unix, Mac OS X and some PDA.
It has 2 licenses:
- for closed source development (you must buy a license)
- for open source development (free of charge, GPL license)
Moreover it has 3 tools (among others) included:
- "Qt Designer" to draw your GUI graphically
- "Qt Linguist" to make your program multilanguage in an easy way
- "Qt Assistant" help system used by Qt and available for your programs too

Toolkit overview (Qt4):
http://www.trolltech.com/products/qt/features
http://www.trolltech.com/products/qt/whatsnew
http://www.trolltech.com/products/qt/learnmore

Documentation (for all versions):
http://doc.trolltech.com/

Qt 4.1 documentation:
http://doc.trolltech.com/4.1/index.html
http://doc.trolltech.com/4.1/overviews.html

It supports a lot of database systems:
http://doc.trolltech.com/4.1/sql-driver.html

Next 4.2 version (it should be available for year ending):
http://doc.trolltech.com/4.2/qt4-2-intro.html

Interesting articles on Qt programming:
http://doc.trolltech.com/qq/index.html

Community site (with forum for help):
http://www.qtcentre.org/

You can find in internet a lot of examples (all KDE programs are written with Qt) and some tutorials.
There are printed books too.

KDE and KDE applications:
http://www.kde.org/
http://www.kde-apps.org/

Tutorials for Qt3 and Qt4 respectively:
http://www.digitalfanatics.org/projects/qt_tutorial/
http://qt4.digitalfanatics.org/tiqt/
« Last Edit: July 20, 2006, 01:13:49 am by iw2nhl »

agent007se

  • Guest
Re: New to Code Blocks
« Reply #7 on: July 20, 2006, 05:44:18 am »
I really don't know a lot of wxWidgets so I can't speak about.

But really '+1' for Qt suggestions. It's a really really nice Toolkit and, moreover, it's extremely well documented :D (I fall in love of their docs :p).

takeshimiya

  • Guest
Re: New to Code Blocks
« Reply #8 on: July 20, 2006, 01:52:39 pm »
Probably the only two cross-platform toolkits well supported, mature, and with a big community are wxWidgets and QT.

Following the list of iw2nhl I'll give a list to start learning wxWidgets.

* The major advantage wxWidgets haves over QT is native widgets. QT haves to use in some platforms, the so called "styles" (for example, in the next 4.2 ver. it'll feature a theme simmilar to GTK's Clearlooks), but wxWidgets already haves native widgets in almost all platforms, that means in the GTK's case that it uses the own GTK widgets and rendering calls, so it's absolutely the same as a native GTK application.
The same accounts for Windows (it uses Win32, and the programs looks the same as MFC programs), in Mac, Carbon and Cocoa, in Linux, GTK, Motif and direct X11 also. That's not the case with any other existant toolkit right now.
* And the major advantage of QT over wxWidgets is perhaps that QT 4.x (not previous versions) haves a more advanced C++ API, altrough that haves disvantages, like making more difficult to get things working on other compilers, and more importantly, it's more difficult to make bindings to other languages. wxWidgets 3.x will feature an up-to-date C++ API nonetheless.

wxWidgets currently haves bindings in the following languages: C++ (not a binding), Python, Ruby, Perl, Basic, Smalltalk, Java, JavaScript, Haskell, Eiffel, C#.NET, Lisp, Lua, among others.

It works on Windows (3.1 to Vista, including Windows CE), Linux, Unix, DOS, Mac OS 9/X, OpenVMS, OS/2, and some PDA.
It has 1 license:
- for closed source development (free of charge, LGPL-alike license, very permissive)
- for open source development (free of charge, LGPL-alike license, very permissive)
Moreover it has a lot of tools (among others) including:
- "DialogBlocks" to draw your GUI graphically
- "wxSmith" to draw your GUI graphically (included in Code::Blocks)
- "poEdit" to make your program multilanguage in an easy way
- "HTB" a help system used by wxWidgets and available for your programs too

Toolkit overview:
http://wxwidgets.org/about/feature2.htm
http://wxwidgets.org/
http://wxwidgets.org/about/

Documentation:
http://wxwidgets.org/docs/

It supports a lot of database systems:
http://www.wxwidgets.org/wiki/index.php/ODBC

Next 3.x version:
http://www.wxwidgets.org/wiki/index.php/WxWidgets3

Interesting articles on wxWidgets programming:
http://wxwidgets.org/docs/tutorials.htm
http://wxwidgets.org/about/reviews2.htm

Community site:
http://www.wxcommunity.com/

Forum site (for help):
http://wxforum.shadonet.com/

You can find in internet a lot of examples and some tutorials.
Recently, the official book has been published, you can buy a printed copy from here:
http://wxwidgets.org/docs/book/

Also, it has been made available as a free PDF download from here: http://www.phptr.com/content/images/0131473816/downloads/0131473816_book.pdf

wxWidgets applications:
http://wxwidgets.org/about/users.htm
http://www.wxcommunity.com/modules.php?op=modload&name=Downloads&file=index&req=viewdownload&cid=5

wxWidgets compared to other toolkits:
http://www.wxwidgets.org/wiki/index.php/WxWidgets_Compared_To_Other_Toolkits
« Last Edit: July 20, 2006, 01:57:18 pm by Takeshi Miya »

Offline iw2nhl

  • Multiple posting newcomer
  • *
  • Posts: 116
  • BASIC, C, C++, Qt, bash
Re: New to Code Blocks
« Reply #9 on: July 20, 2006, 08:25:14 pm »
Ok, Takeshi Miya, but mine was not a Qt vs. wxWidgets comparison, I only presented a little overview of Qt!
If you want a true comparison, give also a description of the faults of wxWidgets.

First of all, native widgets: is this really a problem?
1) they are NOT slow (they use native drawing primitives) and are exactly like the native ones
2) Microsoft for some of his programs (most important ones) does NOT use native widgets: MS Office used 13 different widget implementations between the various releases, and they are still present in recent releases, some dialogs use one, some use others); Internet Explorer too does not uses native widgets to draw web pages.
3) under Windows XP and Mac OS X native widgets are used (most of people use theese OS)
4) under KDE (Linux, BSD and Unix) Qt IS the native widget
5) under PDA wich support Qt, it IS the native widget
6) under Windows 9x/2000 it draws (using native, hardware accelerated drawing functions) widgets that are visually identical to native ones
Speaking of wxWidgets:
1) Windows 3.1 is no more supported (means: code has been removed)
2) not all widgets are native under wxWidgets too (see: http://www.wxwindows.org/manuals/2.6.3/wx_wxrenderernative.html#wxrenderernative)
3) there is no "style" for KDE (while this is not true for Qt under GNOME)

I don't know wxWidgets very well, but I read this (probably this is a reductive list):
- very simple painting system (see here for a very-short description of the powerful Qt painting system, with anti-aliasing, gradients, double-buffering, styles and others: http://doc.trolltech.com/4.2/paintsystem.html)
- documentation is very far from the Qt one
- Qt is all pure C++ programming (if you like full OOP), while in wxWidgets you have a lot of macros and this makes programming less natural to a C++ developer
- Qt supports different programming style (loops and iterators): C++, STL, Java-like
- Qt (human) support from Trolltech is excellent (this is important for large projects)
- with Qt/Embedded you can use a Qt program without anything else than QT/Embedded itself! It includes the OS (Linux based) and a graphic system: nothing more (no X server) is required, so CPU and RAM are free for your application. Now (Qt4) it has become Qtopia (http://www.trolltech.com/products/qtopia/qtopia_platform)
- at a first sight, wxWidgets has much less classes, both GUI and not-GUI related than Qt (means less developer time with Qt: less code and use of well-tested classes)
- also Qt has bindings (althought less than wxWidgets), most used ones are Python (PyQt), C# (Qt#) and Ruby (QtRuby), others are Tcl (Froglogic Tq), Java, Perl, and Smoke; in the past there was also C but it is no more mantained
- there are also transition tools for MFC, Motif, Tcl/Tk and others
- Qt supports also his own scripting language with Qt Script for Applications (QSA: http://www.trolltech.com/products/qt/addon/qsa)

Like anything else, Qt is not perfect and has its drawbacks, anyway remains among the best C++ toolkits available today (and is continously evolving).
The main drawback is that it requires more RAM and CPU power than native applications, but it is well payed by the easy of developing, the features it offers and the easy of portability.

For a list of supported platforms and compilers:
http://www.trolltech.com/developer/notes/supported_platforms

Obviously I'm not an expert of both Qt and wxWidgets: if there are mistakes, please let me now!

Best regards,
Alessandro
« Last Edit: July 21, 2006, 01:23:47 am by iw2nhl »

takeshimiya

  • Guest
Re: New to Code Blocks
« Reply #10 on: July 21, 2006, 01:54:23 am »
Ok, Takeshi Miya, but mine was not a Qt vs. wxWidgets comparison, I only presented a little overview of Qt!

It was not a comparison, the intention is to give helpful links as you gave, for people like DaveK who is wanting to get out of .NET.
In that sense, as I've said, I think the two cross-platform toolkits well supported, mature, and with a big community are wxWidgets and QT.
So with the info from both, he can test and learn both of them.

Quote
6) under Windows 9x/2000 it draws (using native, hardware accelerated drawing functions) widgets that are visually identical to native ones
This is the biggest thing I don't like about QT, I use Windows, and I use a theme that is not Luna, and believe me, "visually identical to native" is far away from "native", and to say the least, it does not feels good. :P

Quote
Obviously I'm not an expert of both Qt and wxWidgets: if there are mistakes, please let me now!
No, no mistakes. We're here just to provide information to anyone who is wanting to start to learn cross-platform programming. :)

Offline iw2nhl

  • Multiple posting newcomer
  • *
  • Posts: 116
  • BASIC, C, C++, Qt, bash
Re: New to Code Blocks
« Reply #11 on: July 21, 2006, 04:37:13 pm »
Quote
6) under Windows 9x/2000 it draws (using native, hardware accelerated drawing functions) widgets that are visually identical to native ones
This is the biggest thing I don't like about QT, I use Windows, and I use a theme that is not Luna, and believe me, "visually identical to native" is far away from "native", and to say the least, it does not feels good. :P
I use Windows 2000 and it is almost indistinguishable, I don't know on Windows XP not using Luna theme, but I read it should support XP theming. Now I know it does not :-(

Anyway no war at all! I think wxWidgets is good too. Surely there will be people who like Qt, people who like wxWidgets... and people who hate both  :)

DaveK

  • Guest
Re: New to Code Blocks
« Reply #12 on: July 21, 2006, 09:44:20 pm »
Wow thank you everyone for the list of replies. I will definitely look into downloading wxSmith and I will try and get Code::Blocks to work with wxWidgets. Is there a good walkthrough online that helps me setup wxWidgets with Code::Blocks?

Thanks!

I have one walkthrough that had a VC++ and a MinGW32 which I really don't know what that is. Perhaps I'm just not putting two and two together.


sethjackson

  • Guest
Re: New to Code Blocks
« Reply #13 on: July 21, 2006, 10:35:09 pm »
Wow thank you everyone for the list of replies. I will definitely look into downloading wxSmith and I will try and get Code::Blocks to work with wxWidgets. Is there a good walkthrough online that helps me setup wxWidgets with Code::Blocks?

Thanks!

I have one walkthrough that had a VC++ and a MinGW32 which I really don't know what that is. Perhaps I'm just not putting two and two together.



http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.6.2_to_develop_Code::Blocks_%28MSW%29

DaveK

  • Guest
Re: New to Code Blocks
« Reply #14 on: July 22, 2006, 04:05:38 am »
Cool! Well I downloaded all the files they mentioned and compiled what they said to compile. The compile went through so I created a new wxWidget project. I was getting wx/setup.h file not found. I tried adding the directory to the Project Settings but that didn't work so I just copied the setup.h file to where I believed the compile was trying to find it. I got past that error but now get this error

D:\CodeBlocks\wx263\include\wx\buffer.h line 96 error: 'strdup undeclared (first use this function)

I'm kinda at a loss here. I don't think I really should have had to move setup.h to begin with. Not sure why even adding the right directory didn't get that file recognized but now code in wxWidget files is coming back with error makes me think I may have forgotten a step.

Anyone else run into similar problems that could help?

i'm sorry if this has already been covered a ton of times. If so, thanks for a forwarding link anyways. :)