Building simple GUI without resorting QT or .NET using native C++? - c++

Are there any platforms to build GUI platform without resorting to QT or .NET using native C++ ?
QT is cool, but take a lot of time to learn, in addition it has a lot of things I don't really need and really dislike QT IDE, compared to Visual Studio (I know you can use QT within Visual Studio)
.NET suffers same problem (I am actually learning C# and WPF right now, though it looks like WPF is somewhat easier to program and you can call native C++ code from WPF)
I am looking for something that is: relatively easy learn, does not have to have advanced features, works with C++11, support C++11 multi-threading, works with Visual Studio. Planning to build some applications for Numerical analysis.

There are lots of alternatives with varying levels of support in VS.
MFC has quite a bit of direct support in Visual Studio in the form of code generators, Wizards, etc. Unfortunately, the basic design is very old and hasn't aged very gracefully at all. Quite a few programmers not only would but do cite it as a prime example of a library that's better avoided if humanly possible.
WTL is Microsoft's other class library for producing Windows applications. It's a much newer design than MFC and generally considered much cleaner and nicer. As implied by the name, it's heavily template based, which helps it produce applications that are generally considerably smaller and faster than MFC ever attempted. For better or worse, Microsoft placed it under a fairly permissive open-source license some time ago, and updates since then have been quite minimal. Despite both being from Microsoft, Visual Studio has never done much to support WTL development.
wxWidgets started as more or less a clone of Microsoft's MFC, but has continued active development while MFC has mostly stagnated. It now has quite a few features (e.g., XML-based UI design, layout managers) far beyond anything MFC ever even considered including.
Ultimate++ is a fairly unusual toolkit that has mapped its own route (so to speak) that's quite a bit different from most others. They have their own IDE (TheIDE). Code can be quite simple and short, but is enough different from most typical C++ that many people find it difficult to grasp at first (and some experienced C++ programmers don't particularly like how some thing work).
GTK+/gtkmm is less of a Windows framework than a Linux framework that's portable enough to also work under Windows. It's probably not your best choice if you're developing exclusively (or even primarily) for Windows. These are also much more purely GUI frameworks than most others (i.e., they don't include things like collections, networking, cryptography, etc., that many others do include).
FLTK is another cross-platform toolkit. Its fairly small and fast, but somewhat like GTK+, it seems (at least to me) less like a Windows toolkit, than a Linux toolkit that happens to be portable enough that it can also work on Windows (but the results don't look or feel much like most Windows applications).
Juce was originally used to develop some music software (Traktion) so it includes a lot of music-oriented functionality. It also have some fairly unusual widgets that most others don't include (especially widgets that imitate controls you'd see on all sorts of audio equipment). Nonetheless, it has a solid core of basic GUI functionality, as well as the usual "extras" like network, crypto, XML and JSON, etc. Although I haven't tried to do anything like a full review of the code, it appears to be rather better written than most.
That's not a complete list by any means, but I think it hits most of the more popular/widely used GUI toolkits (other than Qt, of course).

Some time ago I asked myself exactly that same question.
I wrote my program using C++/CLI, which was not bad (my C++ code was very well isolated from the GUI/CLI part), but sharing the executable with others was a problem: it was the typical - it runs in my PC(...only). So, I needed a light alternative to the user unfriendly command line programs in scientific calculations, which I could easily share.
I am now happy to use Nana. Please join the group of users and / or developers of Nana and... have fun!
GUI with Nana C++ Library
Nana C++ Library takes aim at easy-to-use and portable library. It
provides a GUI framework and threads for easy programming with modern
C++ methods, such as traits, metaprogramming and other template
technologies.

Since you plan to develop exclusively for Windows, I think you should stay with MS provided GUI toolkits. While third party toolkits may provide the cross platform advantage you already said don't need, they add complication and dependencies.
Complication by for example when a new Visual Studio is released, then you have to wait for the toolkit to get that new VS supported, and dependencies, which means more dlls to be installed on the target system.
Plus some toolkits do not use the native look of the operating system, like many java programs for example.

Related

How to go about creating a windows application

I've been looking at a lot of different options for creating a GUI windows application. Win32, Windows forms, MFC to name a few. I know my C++ well, I just need some advice on where I should start learning some GUI for windows. Thanks!
Qt has helpful tutorials. Easy to learn. Open source. Many resources on the web!
MFC is quite a dated technology now; The kinds of books/tutorials available for it are similarly aging. QT is becoming far more widely used and is likely a much better starting point from a learning perspective.
There are of course plenty of other alternatives beyond C++; C# and .NET are good choices if you are specifically interested in development on Windows. C++ programmers tend to find their feet in C# quite quickly, although any new language/environment does of course have an extra learning curve
I would look into Qt, OpenGL and SDL (Simple Directmedia Layer).
Qt provides an easy way to build GUIs, I would (loosely) compare it to Java's Swing.
OpenGL and SDL are more about plain graphics, both being used in various games and applications.
I use MFC commercially and I'd have to say for strictly GUI/Windows apps, you might want to look at C# (either Winforms and/or WPF). MFC is getting pretty dated. You can get a lot more done in the same amount of time with C#. Sure it might run a tiny bit slower, but for UI apps, I think programmer time is much more important metric than execution time.
If you want to use C++ for UI, maybe have a look at Qt. It is continually updated/enhanced and is not limited to a single platform like MFC is.
Good luck!
It is as helpful to develop a windows based applications! their are many open sources and Ides to develop windows applications.
One of them are Visual Studios, it is an IDE ie..(Integrated Development Environment) developed by Microsoft for both windows and web based applications development.As it has an advantage that an individual should be proficient in any programming language that he/she knows about.This IDE is integrated with the .net framework which have the capability to manage the code and compile with the help of Microsoft Intermediate Language (MSIL)and CLR common language at Run-time.The type checking is handled by Common type Specification for all Programming languages.JIT compiler is a compiler to execute to semi finished code and turns to code in to bytes.The main languages are handled by these IDE are C++,VC++,C#,Visual Basic,F#,J#..etc

What is the best way to get started in GUI C++ programming?

So, I learned C++ (fundamentals) and I want to write software, however I have stumbled upon a problem where I don't know where to get started. It seems like learning C++ was the easiest part by far when it comes to understanding the libraries for the GUI construction the concept I yet don't fully comprehend. I searched a lot and couldn't even decide been a new guy on MFC, Win32 or Qt.
Qt C++ GUI seems like a fun and easy to use software with the definitions of classes available right there quickly.
With Visual's MFC I am seeing a lot of code upfront on the pre made project file and a lot of description of classes, however getting definitions is a bit slower as I have to go to the internet.
Win32 is apparently written in C and is not updated much?
A lot of people recommend Java and C# as well, but I am not interested in learning a new language when I don't have C++ set in stone and practiced with enough yet.
Not sure how to go about this.
Go with Qt if you envision porting your program to platforms other than Windows and/or your actual UI needs are relatively straightforward. But Qt, being "fun," abstracts you away from the Windows API, so if you find yourself needing to access features of that API not offered by Qt, then you'll be up the creek. So go with MFC if you're staying on Windows and you're building an application whose complexity or Windows-specific features may require more direct access to the Windows API. MFC provides a thin abstraction layer over that API; its concepts map more or less one-to-one with the API's concepts.
What kind of GUI do you want? Any framework should be able to do any kind of GUI, but some are optimized for certain work:
MFC is optimized for making applications that edit documents, like MS Office programs Word, Excel, Powerpoint.
wxWidgets and Qt (and .NET WinForms and WPF) are optimized for any sort of app that primarily uses widgets (textboxes, buttons, menus).
SDL is optimized if you want to draw stuff, like graphs or vector artwork.
I wouldn't recommend that you use MFC since it isn't a good fit for most applications, and also doesn't use modern C++ design, it's loaded with workarounds needed for stuff that was broken in early versions of Visual C++ and now can't shake those workarounds because of backward compatibility.
The Win32 API is actually really useful to know regardless of what kind of application you want to make, because it defines the rules for how the UI interfaces to the rest of the system. Yes, it's written in C, but this is to make it usable from any programming language, not because it's an obsolete design. Win32 API is highly object-oriented and uses polymorphism extensively.
Few things you need to be aware of:
If one day you want to sell a program written using Qt you might need to purchase a license.
If you feel like GUI applications/ GUI programming is what you want to do in general, for windows platform you better learn WinForms or even better WPF (with C# of course).
If you just want to quickly put up simple GUIs for your C++ programs for learning purposes, and you don't care much about learning the frameworks and licensing issues, just go with Qt or wxWidgets.
MFC is outdated. If sticking with C++ on Windows, I recommend you to lean C++ CLI.
However I suggest you to learn c# directly since c# is the mainstream language in .Net world.
For GUI, the windows world is now dominated by WPF.

What is the best library to use when writing GUI applications in C++? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Gui toolkits, which should I use?
I've got a fair bit of C/C++ experience - mostly for writing console application for Windows/Linux, and also a fair bit of C# experience - generally for writing WinForms applications etc.
I'm extremely impressed with with ease at which I can create a window in .net, for example something as simple as
Form form = new Form();
form.ShowDialog();
is enough to get a blank form up on the screen. In fact,
new Form().ShowDialog();
is technically enough as long as we don't mind losing reference to the form after it's closed.
I've tried writing some windows-based GUI stuff in C++ using windows.h, but not only does the learning curve seem a little steep but also the syntax is extremely verbose. Creating a simple window like the above mentioned single line .net implementation can easily exceed 2 dozen lines using windows.h.
But not only that, if I were to port the application over to Linux/Max (something which I can pretty much never do with .net, with the exception of hacks like mono etc), then I would need to rewrite 95% of the GUI code.
I'm assuming this is where frameworks come in, for example QT etc... (I don't really know much about gui frameworks, I'm afraid).
What GUI frameworks do you recommend? which are the most powerful and which are the easiest to use?
How do you generally tackle the task of coding your GUI in C/C++?
The closer to the metal (so to speak) that you are programming, the more difficult things get. WinForms (provided by the .NET Framework) is a pretty outstanding abstraction over the Win32 API, considering the complexity you've already seen that it involves for the even the simplest of tasks, like getting a window to appear on the screen. All of that is still happening in the background, of course (registering a window class, creating the window, etc.), you just don't have to write the code yourself.
It's interesting that you write off Mono as a "hack", but would consider a library like Qt. I'm really not sure on what basis you make the distinction. The Mono library is widely regarded as excellent when it comes to WinForms support. The biggest detractors are the same as Microsoft's own CLR implementation, namely that it doesn't produce truly native code, which is more irrelevant to performance in the majority of situations than one might think. Beyond that, some complain that Mono applications don't conform fully to the platform's UI guidelines (that is, they don't look and behave exactly like a native application would), but I have a similar complaint about applications written using Qt.
It seems like literally everyone recommends using Qt if you want to do GUI work in C++. As I mentioned above, it happens not to be my favorite library because I'm a stickler for using fully native controls and widgets provided by the platform you're currently running on. I understand that Qt has gotten a little better at this recently, but I still don't think it's up to my standards. If you're more flexible than I am (and I'll warn you that the average Mac user is not any more flexible than I am), and true platform independence is a big concern to you, it's probably the one you should opt for. Many people praise it for its design elegance and convenience, although I seriously doubt that even it offers the same simplicity as the .NET Framework's implementation.
If sheer simplicity and terseness of code is as important as the beginning of your question makes it sound, I highly recommend sticking with C# and WinForms. Things get harder as you start to remove layers of abstraction, and if you don't need the extra levels of control that doing so affords you, there's hardly any justification for making more work for yourself. Mono's Forms implementation is a perfectly viable solution for cross-platform applications, assuming your needs are relatively modest.
Beyond that, if you want to create a truly cross-platform application in C++ the right way, I recommend that you strictly separate your data layer code from your UI layer, and then write the UI using the tools provided by each platform you want to support. In Windows, your options are relatively open: .NET WinForms is a solid choice, native Win32 is a somewhat painful though merited option, and a handful of other libraries like MFC and WxWidgets can help to ease the pain of fully native programming (though not nearly as well as WinForms does). On the Mac, the only real option is Xcode, Interface Builder, and Objective-C, targeting the Cocoa framework. Linux/Unix-based systems are hardly my forte, but I'm given to understand that Qt is about as native a library as you can get. This sounds like more work than I think it is—a well-designed library should handle 80% of the work, leaving only around 20% that you have to do in implementing the UI. Beyond using truly native controls and widgets, I think the other big advantage afforded by this approach is flexibility. Notice how Microsoft Word looks very different (despite some superficial similarities) on Windows than it does on the Mac. And iTunes has become almost a paragon of excellent UI design on the Mac platform, but sticks out like a sore thumb on Windows. On the other hand, if you rolled out something like Windows Media Player on the Mac (and yes, it's been tried by Microsoft themselves, though without much success), Mac users will dismiss it as a complete abomination and probably be somewhat offended that you even tried. Not so good for the truly cross-platform-minded developer. All of that to say, if your app is anything but the simplest of utilities, you'll probably find that an entirely different interface is justified (and even expected) on each platform that you want to support.
No matter how great Qt may be, you're not going to get that with it.
Qt, hands down.
it's the most complete, most mature, fastest framework available. and on top of it, it's seriously multiplaftorm and your choice of commercially friendly open source or paid support.

How does C++ builder stack up against other RAD IDEs?

It has been a few years since I did any development for PCs (I usually do embedded software).
At that time I was highly proficient with (Borland, now CodeGear) C++ Builder. Time has moved on, C++ Builder has become extremely expensive and there are alternatives (MSVC studio, NetBeans, QtCreator, maybe even Eclipse with the right plugins). Others?
Three things concern me (in no particular order), ease of use, additional GUI components and cross-platformness.
Ease of use - I want an IDE which helps, not hinders me. Good debugger, refactoring, jump to variable declaration, usage, that sort of thing ..
GUI components - when using C++ Builder I was impressed by how easy it was to develop additional VCL components and how many were available, often for free. Thus if I wanted a standard string grid where the cells also could contain pictures, checkboxes, etc, I could probably find one, or roll my own.
I am not sure what the current state of play is with respect to add-on components. Do other systems have anything like http://www.tmssoftware.com/site/ ?
Cross-platform - I personally use Linux for everything, but realistically, the majority of my users have Windows installations. So, cross-platform is "nice to have", "all other things being equal".
Now I have to pick a solution and stick with it for the next few years. Which one, given my points above (cost plays a role, but is not make/break)?
Thanks in advance for your help.
I have used both C++ Builder and Visual Studio.
Over the years I have always preferred C++ Builder over V.S.
Builder and VCL just feels much better designed than Microsoft's products.
(Even the Borland library source code just looks cleaner than anything
that comes out of Microsoft).
The integrated debugger in Builder is truely integrated and quite intuitive to use.
I find Builder compiles much faster than Visual Studio.
Builder 5 had a problem that made it unnecessarily slow,
but at the time it was still faster than VC++
and the latest Builder versions have faster compile times.
Accellerators such as TwineCompile make Builder even faster.
I've never tried to create custom C++ controls for Visual Studio,
but it is fairly easy to do in Builder.
Last year, CodeGear released a free version of TurboExplorer
(I haven't used it myself) which includes the IDE
and RAD (although limited) http://www.turboexplorer.com/
TurboExplorer can be used for commercial apps.
I have not been happy with Java based IDE's where are always slow.
I.e. SunStudio12 which is good (and free) but the UI is slow response.
I use Code:Blocks on Linux which has reasonable usability,
but haven't done any RAD work with it.
I never used C++ Builder but used to be a big fan/user of delphi. I normally work on server apps in c++, with some java. Reciently I started writing some small productivity apps for myself originally I used java, but then moved to Qt.
Now I love it. The library feels well designed just like vcl did in delphi. The signals/slots mechanism is great, I am still surprised how often I don't have to write code to wire up a dialog box. Using qt is easy and the code you write is very easy to read and create. I haven't yet had to write my own widgets, I think qt's model/view architecture splits the roles very well making the stock widgets very powerful. For example when using a QTableView most display and editing functions can be provided by the ItemModel, more powerful control is provided by an ItemDelegate. I have found these easier to reuse than writing custom widgets although it seems easy enough from looking at the documentation.
Qt creator is basic but does 95% of what I require, integrated project, gui designer, code, debug and help. Has support for CMake as well as qmake. It doesn't have advanced features like refactoring, but the intelli sense better than VS2005. However the next version of KDevelop looks very promising and will include these. You could also use eclipse if you wanted these features, or move between eclipse and qt creator as required. But I am very happy with qt creator.
On the cross platform issue, I develop my apps on Linux at home and tend to use them on windows in work. So far everything that works on linux works just work windows and looks like it was written for it too.
The strength of C++ Builder (and also Delphi) is the VCL GUI framework, it is easy to work with, and delivers true RAD development. There are a lot of alternatives to VCL which all have their strengths and weaknesses. The strength of VCL is the close ties with C++Builder/Delphi which makes it work very well with that combination. The downside is that it is propitiatory software, which means that you are unlikely to port your code to other IDE's or platforms without official support from Codegear/Embarcadero.
There is however some free alternatives out there, one of the more interesting being the Lazarus IDE. The Lazarus IDE is an IDE for the Free Pascal language, this is very similar to that of Delphi, I must admit that I am not a Delphi guy myself, so I am unable to go into too much detail about this. Lazarus have a GUI framework much like VCL called LCL. From the brief looks I've had on it, it looks very similar. There are several good things about the Lazarus/Freepascal package especially for your case. It is free, it can compile and build for both windows, linux, and mac, it has 64 bit support. Further more the compiler seems more modern than the Delphi one.
Lazarus running on Windows 7
Lazarus running on Linux (GTK2)
Lazarus running on Mac OSX
More screenshots can be found here: http://wiki.lazarus.freepascal.org/Screenshots
The problem with Delphi/C++Builder is that the VCL is not currently crossplatform capable. Although this is planned for future versions (as far as I recall) it is not yet implemented. Having noted that, there are some considerations as to whether the C++Builder will continue to be maintained or not, in here there is some comments on this: here.
Qt has been mentioned and it is indeed a very strong GUI framework and the Qt creator is a fine tool, personally though I like to have a very close bond between the IDE and the GUI framework like it is the case with the VCL, but that is very dependent on the developer.
Edit: Just a thought I had, when comparing C++Builder to other RAD IDE's it is easy to include IDE's for the .NET languages and Java. These use languages created for this purpose. C++ used in C++ Builder does, although in Borlands version slightly modified, not. This does raise an interesting question, is using C++ for RAD applications necessary and justifiable? Why not use a tool (language) that is written for the purpose. I am aware that C++ Builder is written for RAD development, but the language behind it was not designed for this purpose. If your need is truly rapidly developed applications, I would consider looking for other languages, but if you dependent on C++ for whatever reason, could be 3rd party libraries etc. Then C++ Builder is in the C++ world an excellent RAD development platform.
Short answer is NetBeans. It is cross platform, it is easy to use, although it is made-in-java but still it is fast.
PS: If you also do or intend-to-do programming in java, it will be convenient to use/learn this one IDE for both.
You can also use wxForms for C++ Builder and use wxWidgets to create cross platform applications. It works with the existing C++Builder IDE and make use of the same form designer.

Is anybody working on a high level standard library for C++

STL/Boost cover all the low level stuff.
But what about the higher level concepts?
Windows: We have multiple windowing libs
KDE(Qt)
Gnome
Motif(C but written in OO style)
MS Windows
etc
But is anybody working on a unified standard for windowing?
Something that wrapped all the above would be acceptable. (even if it only accessed the common stuff it would be a starting point).
Networking:
There are a couple out there (including the Boost low level stuff).
But is there anybody working on a Service based network layer?
All the other stuff that Java/C# have in their standard libraries.
The stuff that makes it simpler for a beginner to jump in and say Wow done and it works everywhere (nearly).
Anyway. Here hoping there are some cool projects out there.
Edit
Maybe there is not one.
But if there are a couple that could be bundled together as a starting point (and potentially modified over time (where is that deprecated keyword)) into a nice consolidated whole.
Note: Windows is just a small part of what I am looking for. The Java/C# languages consolidate a lot more under the hood than just the GUI. What would be a good set of libraries to get all the functionality in one place.
There are too big differences between platforms to get a definitive C++ standard for GUI programming. I think Qt is about as close as you will get in the forseeable future. wxWidgets is another popular choise, but as I understand it, they are using less modern c++ features.
As for networking, I think you are being kind of vague. If you mean web services over HTTP, I would have a look at Pion.
Well it is almost 2010 and C++ almost has threads.
I'll probably get slammed for this but C++ moves too slow - to its own detriment and its user base. I readily acknowledge the difficulty of the technical and political issues involved but that's still the dirty reality of it. The language can't build in higher level concepts when it takes 5-10 years to agree on and implement the building blocks.
The reasons for this have endlessly debated but the sad truth is that C++ has relegated itself to a niche language. I like C++ but I look at the progress C#, Java, and even Python and Ruby have made over the last 5 years and I increasingly question whether C++ is worth the effort.
The Poco C++ project aims to deliver all that you ask, except for Windowing:
The POCO C++ Libraries aim to be for
network-centric, cross-platform C++
software development what Apple's
Cocoa is for Mac development, or Ruby
on Rails is for Web development — a
powerful, yet easy to use platform to
build your applications upon.
Qt might be the only framework complete enough to be what you suggest.
I guess there's some kind of keyword lookup driving the advertising here because I'm seeing a REALbasic ad, which is what I generally use for cross-platform GUI's nowadays.
I have spent a lot of time over the last 15 years working in C++ GUI's including retailing my own portability layer for CodeWarrior PowerPlant and working on the two Macintosh-based GUI code generators, including adding Windows generation to AppMaker. I've worked with wxWidgets, mainly wxPython. So, my opinion on difficulties in cross-platform GUI is fairly well-qualified :-)
Cross-platform GUI frameworks are hard to the point of nearly impossible without significant compromise - the issues come down to subtle matters of behavior which generally bother users at a level where some of them can't quantify but know that the application doesn't feel right. This is a lot harder to fix than just rendering native controls.
I started using REALbasic because their framework does a better job of getting the feel right than anything else I'd tried (I didn't get into Qt because of the expensive commercial license).
The reason it has taken so long for things to evolve is nothing to do with the C++ world moving slowly, it's just an intractable problem. The very best cross-platform Java apps do some stuff conditionally for OS/X and it is still screamingly obvious to an experienced user that they are not a native Mac app, although some are very usable and come pretty close to looking native - Oxygen XML editor and DeltaWalker are two of my favourites.
I don't think it is achievable to make a really comprehensive portable GUI library. Operating systems are just too different. Can you imagine a GUI library that would cover everything from iPhone to Windows 7 and wouldn't feel wierd on any of them?
A Boost gui library comes up occasionally.
The general opinion seems to be that the problems is too wide (are you targeting cellphones, FPS games or CAD workstations) and that it is too much work - Qt/wxWidgets has taken 10years.
see http://lists.boost.org/Archives/boost/2005/09/94453.php for a discussion.
It would have been nice because GUI usually means cross platform and threads, so all the GUI toolkits have invented their own cross platform,filesystem and thread classes. On the other hand if a standard GUI had been introduced in C++ it would probably look like TK !
What's so great about standardization ? Sure, if novice coders want to download one SDK to build portable apps, let them download Qt (or something similar) and forever remain within it's fine walled environment. But it'd be a tragedy if the C++ world revolved around that one library and boost and POCO and wxWidgets and clutter and blitz++ and eigen and and 101 other wonderful things (yes, gtkmm and ACE even) were stifled at birth because the gatekeepers of The Standard Library didn't see fit to admit them.
Diversity is good I think (although when dealing with it, it helps to have a good package manager; I've spent hours setting up build dependencies on Windows which just needed a few seconds of apt-getting on Debian).
ACE is great for concurrent communication and networking.
For cross platform windowing, there's wxWidgets. (formerly wxWindows).
Only everybody and his brother, but hardly any of them actually get anywhere.