Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,198,779 members, 7,969,311 topics. Date: Tuesday, 08 October 2024 at 03:38 AM |
Nairaland Forum / Science/Technology / Programming / Hope For C++ Newbies: Gui Toolkits (17282 Views)
How To Create A Simple Calculator Using Java Programing Language GUI / What Development Chain Do You Use For C++? (2) (3) (4)
(1) (2) (3) (4) (Reply) (Go Down)
Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 11:05pm On Dec 19, 2013 |
HOPE FOR C++ NEWBIES: GUI TOOLKIT One of the most depressing thing about learning c++ is the fact that there is no official GUI toolkit : You start out writing console programs and hopefully wait for the tutorial book you are reading to introduce how to create windows and buttons and blah blah blah... just to figure out that you are at the last page of the book. Then you ask yourself "but java and vb.NET and c# has GUI libraries by default and they make awesome GUI apps and not this black console with white letters I'm seeing here ". And finally in a rather depressed mode, with your hopes dashed by this disappointment, you decide to abandon C++ for Programming Language X . Well, I decided to make this post because this is exactly what happend to me and what could have possibly happend to alot more people, and I've come with good news of great tidings There is a reason C++ was designed like that: to make it very simply for you to learn, use and control. If you want to learn c++ you just learn the basics of c++ and not making a window appear or making a button click to show "Hello, World!". Now since there is no Official GUI Toolkit for c++, third parties can implement there own and all you have to do is simply include these libraries to your projects and , viola, you can then write GUI apps. five year ago In my quest for GUI library for C++ I came across Win32 api, a set of Microsoft Windows Application Programming Interfaces (API) that you can use to not only program against the Windows Platform, but you can use it to create GUI applications. Though it's actually implemented in C programming languge, but since c++ is a superset of C, you can also use it in your c++ projects. To be honest with you, it was a frighteneing experience; to create a simple window had a alot of codes in it, and being a basic vb.NET programmer I felt things were really going bad for me in terms of C++.To make programming with win32 api in c++ easier, Microsoft has a c++ wrapper for it called Microsoft Foundation Classes (MFC). Now the problem is that MFC is not free, you've got to pay for it. At this point I took a break from c++ with a broken heart. Then I discovered wxWidgets and Qt. My marriage to C++ was saved when I realized they were Powerful open source GUI libraries for C++ . The best among the two is still debated but they are great tools for your GUI c++ projects. your major requirement is to have a good understanding of the Object Oriented Construct of C++ because they make heavy use of it. wxWidgets is released as source ( the recent stable being wxWidgets 3.0.0), the download size is supprisenly below 50mb, so you'll have to build it yourself with the configuration you like. But I assure you that the build process is nothing to be afraid of. When you are done building the libraries you are now free to use it to make your awesome GUI app. Qt , which was formerly owend by Nokia but now acquired by digia, is released as pre-built binaries for different compilers ( either GCC or MinGW, or MSVC 2008 2009, 2010 and so forth), the download size is quite large the MinGw and visual c++ packages have size above 450mb. Your duty is simply to download it and use, though there is an option for downloading the source if you feel like grabbing the bull by the horn and bulding the library yourself. Besides GUI, these toolkits also provide some utility functions like Inter-precess communication, Networking functions and file system functions wxWidgets comes as source with documentation and sample applications included. Although it has no IDE distributed along with it, it is supported by a wide range of IDE: code::blocks, codelite, visual studio, eclipse and a host of others... some of these compilers e.g code::blocks and codelie have RAD tools (Rapid application Development tools) for wxWidgets where you can simply drag and drop GUI elements to design you app. There is also wxFormBuilder that is simply a GUI designer for wxWidgets (and its great as well) finally wxWidget has an active community and has great number of applications developed with it e.g some of the blackberry emulators distributed by blackberry for app development were built with wxWidgets. Qt is released as prebuilt binaries though you can still get the source code. It comes with a vast amount of documentation and example applications. And it has its own IDE, QtCreator, which is a RAD tool for Qt and can also be used as an IDE for non-Qt project ( Ironically I use it for wxWidgets projects also). Qt is equally supported by other IDE like code::blocks and visual studio through a visual studio Qt integration ( that doesn't work for express editions). There is a healthy community of Qt users where You get lots of your questions answered. For applications developed with Qt, there are lots of them but the one I'm sure every body knows is the Video Lan Client a.k.a VLC media player For me, I use both of them, but I tend to use wxWidgets more and I will advise Newbies to first taste wxWidgets before moving over to Qt, also keep in mind that these are not the only c++ GUI toolkit out there, there are lots of them. Now the advantage of c++ not having an official GUI library is to give people that freedom to choose which toolkit to use on which ever platform desired. Funny enough on windows platform wxWidgets is like MFC, just a c++ wrapper for win32 api That's all for Now and I'll be willing to help out in anyway if there is any configuration confusion. I hope sharing this bit of my knowledge and experience helps out someone. So don't give up on C++ wxWidgets www.wxwidgets.org Qt [url]qt-project.org[/url] 3 Likes |
Re: Hope For C++ Newbies: Gui Toolkits by Tritglorlee: 3:00am On Jul 03, 2014 |
Actually, before you learn C++ to program, you can begin with learn C# programming language. And you can find a forum or a certian website that can offer a lot sample project programming sample code to learn, if you are interested, this is a barcode creating third party that offers a lot online demo VB codes and C# codes on barcode drawing that can be easy to understand. 1 Like |
Re: Hope For C++ Newbies: Gui Toolkits by KazukiIto(m): 7:37pm On Sep 06, 2014 |
@BlueMagnificent Actually I'm currently facing dis situation. I want to present a little GUI application to my lecturers 3months from nw, implemented in C++. Personally I love that "black screen and white characters", but I'm not sure my lecturers will fancy it. Anyway thanks for mentioning wxWidget, because forking out 1.7GB to download Qt in dis part of the world, is more than a herculean task for me right now. But jst for 'asks'(sic), is implementing GUI in wx really messy? |
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 9:13pm On Sep 06, 2014 |
@KazukiIto, though I don't really understand your question if implementing GUI in wx is messy, I guess you mean if its difficult and complicated but its not . There are WYSIWYG tools for wxWidgets to make GUI creation easy for you. I use wxWidgets as my default GUI toolkit |
Re: Hope For C++ Newbies: Gui Toolkits by KazukiIto(m): 9:24pm On Sep 06, 2014 |
BlueMagnificent: @KazukiIto, though I don't really understand your question if implementing GUI in wx is messy, I guess you mean if its difficult and complicated but its not . There are WYSIWYG tools for wxWidgets to make GUI creation easy for you. I use wxWidgets as my default GUI toolkit ya I meant complicated btw. Thanks for de tips once again. I will check it up. |
Re: Hope For C++ Newbies: Gui Toolkits by jereal(m): 12:19pm On Sep 11, 2014 |
Really nice information. this is exactly what i needed. Thanks @BlueMagnificent. |
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 1:17pm On Sep 11, 2014 |
jereal: Really nice information. You are welcomed |
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 1:18pm On Sep 11, 2014 |
I figured out some folk needed this kind of info |
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 4:11am On Sep 16, 2014 |
BUILDING WXWIDGETS FROM SOURCE In reply to a request made by one of us I will describe how to build wxWidgets from source using both MinGW and Visual Studio, and also how to use it with Code::Blocks IDE. I assume that you are using a windows machine and that you've downloaded the source for wxWidgets either as a zipped file or as an installation. Note that both the zipped packaging and the installation packaging of the source are the same thing its just a matter of packaging . Unzip (or install) the package to a directory, preferably something like C:/wx. When you are done you see sub directories like build, demo, lib, src, etc in it, navigate to C:/wx/build/msw. Building for Visual C++ is very easy. Already contained in this build/msw directory are solution files for the supported versions of Visual Studio. All you need do is to simply start up the required solution file, select the build configuration of our choice and build. As simple as that. But on MinGW, the game is a bit different. First of all you should have MinGW installed in your system (I believe you've already done that). Open up your windows command prompt and navigate to C:/wx/build/msw. Next add the bin folder of your MinGW installation to your build path. This folder in usually in a directory structure like this C:/MinGW/bin (that is assuming you have MinGW installed at C:/MinGW). To add it to your build path, still on your command prompt, type the following followed by enter key set path=%path%;C:\MinGW\bin Do not forget to replace "C:\MinGW\bin" above with the appropriate directory path of your MinGW's bin folder. Before we go off building it is important to understand that wxWidgets has several configurations you can build it as, I will list some of the important ones below: BUILD > either build a release build or a debug build SHARED > either to build as static lib or dynamic lib (DLL) MONOLITHIC > either to build as a large junk of library containing all modules or build the individual module as separate small library UNICODE > either to use Unicode character encoding or not For this post we will be building a release monolithic unicode DLL library. Still on your command prompt enter the below just to make sure the coast is clear of any previous build: mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 Next enter the following: mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 Its going to take quite some time, so I will advise you to seat back and relax (a couple of drinks won't be bad ). When its done building and no error was indicated, close the command prompt and head to C:\wx\lib\gcc_dll you should see your built libraries staring back a you . If it didn't build post the error messages it gave lets sort it out. Linking To Codeblocks Its assumed that your version of codeblocks is version 13.12 Open up code blocks and go to File Menu > New > Project , select wxWidgets and attend to the wizard page questions as follows First Page > (skipped) Second Page > Select your wxWidgets version which in our case is wxWidgest 3.0.x Third Page > (your can handle this) Fourth Page > (you can also handle this one) Fifth Page > make your choice depending on what you are building, Its most likely going to be wxSmith and Frame Based Sixth Page > Your wxWidgets installation directory (for this post that will be C:\wx). Seventh Page > For compiler select GNU GCC compiler and only check "Create Release configuration" . Eight Page > besides the default values here, make sure the following are also checked : "Use wxWidgets DLL", "wxWidgets is built as monolithic library" and "Enable Unicode" Ninth Page > Ensure that "GUI Mode Application" is selected You should have a wxWidgets project generated. On building this project and running it you should see a very boring window |
Re: Hope For C++ Newbies: Gui Toolkits by KazukiIto(m): 12:17pm On Sep 16, 2014 |
Thanks @BlueMagnificent, you are God-sent. |
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 1:00pm On Sep 16, 2014 |
KazukiIto: Thanks @BlueMagnificent, you are God-sent. You are welcomed... Hope you were able to build it |
Re: Hope For C++ Newbies: Gui Toolkits by jereal(m): 2:48pm On Sep 16, 2014 |
EXCELLENT post @BlueMagnificent The problem I have is still being torn between choosing qt or wxwidget. Read countless opinions on various forums, and somehow, they all seem to favour qt more...and up untill now, I had made up my mind I was going with wxwidget. But I'm beginnig to have a rethink right. Which do you do you suggest...? |
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 4:13pm On Sep 16, 2014 |
jereal: EXCELLENT post @BlueMagnificent both are excellent, it depends on the one you feel more productive with. Qt has really good UI implemeted using themes, that is, most if not all the control of Qt are actually drawn by qt instead of using that provided by the system... If you feel that the perfomance consequence of this is not a issue ( which honestly should not be ) and you are okay with your applications looking non-native, then you can go for it. On the other hand wxWidgets uses the controls provided by the default gui implementation of its target platform (win32 api in the case of windows). This gives your application a native look with the down-side being that applications UI look different or different platforms. I use both but tend to use wxWidgets most of the time |
Re: Hope For C++ Newbies: Gui Toolkits by jereal(m): 7:29pm On Sep 16, 2014 |
BlueMagnificent: It's obvious that whichever I start with, I'm eventually gonna have to get familiar with both... I'm resolving to start with wxwidget, considering the fact that it comes with code::blocks already, & I'd not need to make any additional downloads. I also re-read your original post and saw that you suggested newbies should try wxwidget first. So wxwidget it is |
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 8:43pm On Sep 16, 2014 |
Its good u start from there... But from your post it seems there is a bit of miss-information about code::blocks and wxWidgets. Actually wxWidgets does not come with code::blocks ( vice versa) . What comes with code::blocks is wxSmith which is a wxWidgets GUI builder. WxSmith is just a code::blocks plugin, you'ld still have to get wxWidgets separately in order to build wxWidgets based apps with code::blocks |
Re: Hope For C++ Newbies: Gui Toolkits by jereal(m): 11:38am On Sep 17, 2014 |
BlueMagnificent: Its good u start from there... But from your post it seems there is a bit of miss-information about code::blocks and wxWidgets. Actually wxWidgets does not come with code::blocks ( vice versa) . What comes with code::blocks is wxSmith which is a wxWidgets GUI builder. WxSmith is just a code::blocks plugin, you'ld still have to get wxWidgets separately in order to build wxWidgets based apps with code::blocks Alright... Downloaded and installed...but i keep getting this...
|
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 3:37pm On Sep 17, 2014 |
@Jereal, check your build configuration, the notification states that you don't have a "release" build of wxWidgets. What does this mean? It means that you most likely have a "debug" build of wxWidgets instead of "release" and you are trying to create a wxWidgets app with Code::blocks but choosing "release" as the build type of your wxWidgets library. What could cause this? If you downloaded the wxWidgets binary instead of building from source, you probably downloaded debug binaries. But if you built it yourself from source you must have forgotten to specify "BUILD=release" as part of your build string. Is there a solution to this? Yes there is. You can re-download the binaries but this time go for release build or you can rebuild the source and specify the "release" option as specifies above. Or still you can use the debug library you already have, just tell code::blocks your wxWidgets is a debug build |
Re: Hope For C++ Newbies: Gui Toolkits by KazukiIto(m): 1:18pm On Oct 23, 2014 |
Hi Guys! So I got this bootleg version of MSVS2013 (yeah I know it's illegal) , and I want to create an empty project to test some of my codes. After adding the codes and then when I build it, I get this "file not found error messages". I don't experience this problem when I choose the "win32 console application" option and I don't want to always choose this option. So is there any way to go around this? Thanks once again guys. Happy Coding!!! |
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 1:30pm On Oct 23, 2014 |
KazukiIto: which file exactly was mentioned as not found |
Re: Hope For C++ Newbies: Gui Toolkits by KazukiIto(m): 2:34pm On Oct 23, 2014 |
"C\user\documents\visualstudio2013\projects" "the file you specified is not found" . Okay you know that particular option (empty project), how can I create and build an empty project without any error? How do you do it? Thanks! update: Finally figured out how to do it. Coding and compiling without issues!!! . Thanks people |
Re: Hope For C++ Newbies: Gui Toolkits by peterincredible: 4:16pm On Mar 01, 2015 |
KazukiIto:pls help mee ooo i tried to compile my own wx widget but it taking too much time, much time than i expected my is taking more than 2 hours till the extent i got tired and icancelled the installation pls nairalanders pls help me solve or advice me what to do the qt installation too is a serious matter pls your help is needed pls thanks God bless you all |
Re: Hope For C++ Newbies: Gui Toolkits by codemarshal08(m): 4:44pm On Mar 01, 2015 |
peterincredible:Do you have issue installing Qt ? be more descriptive ! |
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 4:58pm On Mar 01, 2015 |
peterincredible: My First wxWidgets build took me ages to complete but it completed and I was so happy. So long as it is not giving any errors its best to let it take its time to build. You might close down other applications and/or turn on high performance in your power setting if it is available. As asked by codemarshal, be a bit descriptive on you qt installation issues. |
Re: Hope For C++ Newbies: Gui Toolkits by codemarshal08(m): 5:02pm On Mar 01, 2015 |
Bro BlueMAgnificent, i sight u ! ........ |
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 5:38pm On Mar 01, 2015 |
codemarshal08: I sight u too... |
Re: Hope For C++ Newbies: Gui Toolkits by peterincredible: 12:33pm On Mar 02, 2015 |
BlueMagnificent:braos my qt installed successfully the only problem i am having with qt is that i dont know how to use the qt creator in which i installed yesterday but soon i will do research about how to use qt but for my own wx widget at the ending it told me that it has an error in installation i will work more on it and i will tell you the out come by the through with it |
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 2:41pm On Mar 02, 2015 |
peterincredible: Ok I'm always around to help |
Re: Hope For C++ Newbies: Gui Toolkits by peterincredible: 10:43pm On Mar 02, 2015 |
BlueMagnificent:finally successfully build the wxwidget yea now pls any material or pdf on how to use the wx widget your contribution will be highly greatfull |
Re: Hope For C++ Newbies: Gui Toolkits by peterincredible: 10:46pm On Mar 02, 2015 |
[quote author=peterincredible post=31244976] pls for those of you that want to build up your wxwidget with codeblock and you are using the new ming32\gcc pls go to this page for full discription on the building of wxwidget http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef |
Re: Hope For C++ Newbies: Gui Toolkits by peterincredible: 8:52am On Mar 03, 2015 |
[quote author=peterincredible post=31245071][/quote]pls i want to ask if any of you have a good book on wxwidget so that i can download it the one i saw is not free you have to buy from amazaon or you read it online pls any recommended text book pls may God bless u all |
Re: Hope For C++ Newbies: Gui Toolkits by BlueMagnificent(m): 11:57pm On Mar 03, 2015 |
peterincredible: Unfortunately the material that is close to being a book that I can recommend for you is the official wxWidgets doc which comes along with every distribution. Believe me, if you take your time with it you'll realize how resourceful it can be. Another thing that can really help you is the collection of sample applications still in the wxWidgets distribution. Reading through their code will teach you a lot |
Re: Hope For C++ Newbies: Gui Toolkits by jereal(m): 12:22pm On Mar 04, 2015 |
@BlueMagnificent... Great job you're doing here... I remember a while back when I was trying to setup wxwidget too, anyway, I ended up going with Qt. its been great so far and I've been working on a project for a while now. But I'm having some difficulty achieving what I want with QPrintPreviewDialog... I'd post snippets if you can help me out. |
Javascript With NodeJS / Learn Java Programming Here Easily / How To Hack Bank Account In Nigeria In 30 Minutes
Viewing this topic: 2 guest(s)
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 108 |