Fog Creek Software
Discussion Board




Writing a GUI in C++ on Windows..

I want to write a GUI application in Windows using C++.  So the quesiton is what libraries are people using to write GUI's on Windows these days and what issues have people run into. 

I realize if I wanted to be realy bleeding edge I could use .Net and Winforms, but for various reasons I don't want to use the .Net framework..

nojuan@nowhere.com
Wednesday, January 07, 2004

I use wxWindows.  It is just simple, clean and works.

And although I've never tried to go run my apps on linux (other than curiousity, and yes they do work fine), you always have this safe feeling that you aren't locked into any particular OS.  And thats a warm feeling ;-)

i like i
Wednesday, January 07, 2004

MFC is (still) the only serious choice.

Grumpy Old-Timer
Wednesday, January 07, 2004

First you have to decide if you want a portable GUI or not i.e if you are making an application which is specifically targeted towards Windows users and not some internal enterprise application or an application which is portable to Linux and other platforms

If you are developing for the Windows platform I would suggest  you use the MFC library for GUI development. It is reasonably easy to learn and quite powerful. 

Using something like WxWindows in this case would not be advisable since Windows users (just like Mac users!) expect the full power of the GUI to be used by the application so that it has a native look and feel with tooltips, dockable toolbars etc...and not just some common denominator which toolkits like WxWindows inevitably tend to use.  This is especially important if you are selling your application in the open market.

If you want a portable solution and do not care about these issues go ahead and use WxWindows or other portable GUI toolkits a nice listing of free toolkits is available @ http://www.atai.org/guitool/#free_toolkit

Code Monkey
Wednesday, January 07, 2004

*ahem*

wxWindows uses native widgets.  It is very very similiar to MFC (infact, find->replace MFC almost).  There are other toolkits out there that do have their own widget set, but wxwindows isn't one of them.

It does have neat features, e.g. you can 'draw' to the printer or to a file with the same code as you draw to the screen.

i like i
Wednesday, January 07, 2004

wxWindows uses native widgets

True but if you depend on them too much your code becomes non-portable :-)

And a UI is more than just putting together widgets..Things like interaction between widgets, learning curve, the "snappiness" of the UI etc are also important. 

e.g take dockable windows. can you do that using wxWindows...not directly unless you use the contributed FL library and then too there are certain issues like using dialogs as windows etc...

This is not to take away from wxWindows...it is a great and mature toolkit...but an engineer uses tools carefully based on the job at hand.  I do not make it into a wxWindows v/s MFC religous debate...

Code Monkey
Wednesday, January 07, 2004

The GUI does not have to be portable (of course I may regret this if Linux takes over the world).

I guess MFC is the obvious choice, but what about newer libraries, I'm specifically thinking of WTL.  Has anyone used it.

nojuan@nowhere.com
Wednesday, January 07, 2004

"True but if you depend on them too much your code becomes non-portable :-) "

umm..what?

have you _ever_ actually used wxWindows?

The native widgets are created and called through the standard wxWindows classes, so if I use code that creates a native button on the mac, the _same code_ will also create a native button on windows.

FullNameRequired
Wednesday, January 07, 2004

"The native widgets are created and called through the standard wxWindows classes, so if I use code that creates a native button on the mac, the _same code_ will also create a native button on windows"

Yes and that comes with a cost in portability which is the very reason they need to have a widget set which was "more flexible" and hence the wxUniversal project. http://wxwindows.org/wxuniv.htm

I would ask you the question.....have you ever used wxWindows for a software that has been sold commercially or is your experience based on developing one off applications?

Either way I am not dissing wxWindows...just making the point that in some cases if you want a native look and feel it is better to not think about portability and use a tool which you are most comfortable with...whether that is Delphi VCL, MFC, Qt  or even wxWindows.

Code Monkey
Wednesday, January 07, 2004

Audacity has been developed using wxWindows. Take a look at the "Audacity" screen shots on http://audacity.sourceforge.net/screenshots-win98.php and tell me that they have a native windows look and feel especially for the toolbars.

Is that bad...no by a long shot...but that also means wxWindows is not the holy grail of GUI portability some try to make it to be.

Code Monkey
Wednesday, January 07, 2004

"Yes and that comes with a cost in portability which is the very reason they need to have a widget set which was "more flexible" and hence the wxUniversal project."

well no....a quote from that very page you link to:

"The main reason for wxUniversal is for a wxMGL port (targetting SciTech's MGL API which works on a variety of platforms including DOS). It is also being used for a MicroWindows port (see below)."

There is no "cost in portability" at all, just that some platforms are harder to target than others.

"I would ask you the question.....have you ever used wxWindows for a software that has been sold commercially or is your experience based on developing one off applications?"

Both at different times :)  <g> Ill ask you...have you ever used it at all?


"Either way I am not dissing wxWindows...just making the point that in some cases if you want a native look and feel it is better to not think about portability and use a tool which you are most comfortable with"

I totally agree, if I was developing an application that was only ever going to target windows I wouldn't use wxWindows, Id use the MS provided stuff.
<g> OTOH most (all?) of my clients request a reasonable level of portability these days.

Truth is, these days Im increasingly using REALbasic as the platform for developing 'one off' applications, its natively compiled, crossplatform and also uses native widgets which makes it perfect for making applications with a standard.
I am increasingly using wxWindows only for commercial apps that require a highly customised look.

and then someone else said...

"tell me that they have a native windows look and feel especially for the toolbars. "

yea, ive been a little disappointed by the wxWindows toolbars myself at times, I do use them when required however as it _does_ provide a portable solution.

"Is that bad...no by a long shot...but that also means wxWindows is not the holy grail of GUI portability some try to make it to be."

LOL
ahh, sorry...I wasn't aware that you were looking for a _holy grail_ of portability.

wxWindows is the best xplat framework Ive ever worked with, and the most complete and easy to use, but I agree that it is still less than totally perfect.
Life is hard for us crossplatform developers :)

FullNameRequired
Wednesday, January 07, 2004

The audacity toolbars had a non-standard look, at let me assure you that you need to go to some effort to make your toolbar look that way.  The "standard" toolbar looks like a native toolbar, no matter what platform you're on.

Seriously though, if you're only targetting Windows, MFC is a much better choice than wxWindows. I love wxWindows, and intend to do most of my GUI development with it.  But my goal is to distribute for multiple platforms, and my primary working environment is UNIX. Those criteria don't apply for you, so there's no sense in loading your applications down with an extra 3 MB library.

Once you get your head around MFC concepts, you'll love both the power and speed that it gives you. The nice development tools  will also be a boon.  I'm no MFC wizard, but the little exposure I've had says that you can do wonders with this toolset. 

Clay Dowling
Wednesday, January 07, 2004

I have used WTL, and like it.

However, you need a good understanding of the API to use it, as it is a "shallower" wrapper than MFC.

Also, good luck finding anyone else who knows it.

It is less complete than MFC, so if you need docking windows, splitters, etc, you can code them yourself, but last time I used it they were not there.

Not officially supported will mean you manager won't like it.


Wednesday, January 07, 2004

Hmmm... so the consus seems to MFC since I don't care about cross-platform.

What's a good book to learn the basics of MFC.

nojuan@nowhere.com
Wednesday, January 07, 2004

WTL is light years ahead of MFC. Fast, small, powerful.

The previous poster is right though, about very few people knowing about it.

Nicky
Thursday, January 08, 2004

Oh, and splitters ARE in the library, and for docking windows have there are some free implementation on the net.

I am not sure docking windows come with MFC either.

Nicky
Thursday, January 08, 2004

We switched over new GUI development from MFC to WTL and have been using it for a couple years. It's ideal if you just need a basic wizard-generated GUI with buttons, menus, toolbars, dialogues, frames etc but want everything else to be your own logic.

Like someone mentioned, it's lightweight (no 1MB MFC overhead or DLL install problems) and keeps things simple because you don't have to derive all your stuff from MFC base classes and wonder what's going on behind the scenes.

The downside is you don't get all the utility code that was glommed into MFC over the years, like the internet and ADO classes, but you do get the basic data structures like CString and CArray, and ActiveX hosting support which is all we need, anyway.

Rick
Thursday, January 08, 2004

Can you suggest good resources about WTL ?

Michael Popov
Thursday, January 08, 2004

You can download it from download.msdn.com (search for WTL), and there is a message board at http://groups.yahoo.com/group/wtl/messages .

Also check the ATL documentation at msdn for the available utility classes (WTL is an extension of ATL)... maybe start at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_atl_atl_class_overview.asp .

Otherwise I've just learned by doing, starting with creating a basic WTL app and seeing what it made. It's pretty straightforward, if you've ever used MFC.

Rick
Thursday, January 08, 2004

Oops, make that download.microsoft.com.

Rick
Thursday, January 08, 2004

Is there a specific reason why is has to be C++? Development skillset, heavy use of the GDI, custom control manipulation, performance issues?

If it's "yes" to any of these then I'd say MFC too. But also, if you're going do MFC, make sure you've got an understanding of the Win32 API too - you'll get stuck otherwise.

If it's "no" to all of them I'd recommend a thin VB GUI wrapper with a C++ back end.

Better Than Being Unemployed...
Monday, January 12, 2004

Has no one hear heard of GTk?

http://www.gtk.org/

Adam Bell
Friday, February 06, 2004

hear == here

Adam Bell
Friday, February 06, 2004

*  Recent Topics

*  Fog Creek Home