Slashdot Mirror


wxWindows vs. MFC

EvanED queries: I'm going to devoloping a chess program, and was until a couple days ago planning to do it in MFC. But then I ran across wxWindows. I think it would be cool if it were able to run under Linux. (At the moment, I do not have Linux on any computer but will as soon as I get my own machine.) Do the benefits of supposed cross-platformness outweigh the drawbacks of having to learn a new system and not having all the (incredibly wonderful) automatic code generation features Visual C++ provides for MFC programs? Or would it perhaps be better to write it in MFC since I am reasonably familiar with it then port it to wxWindows?"

7 of 103 comments (clear)

  1. wxWindows definately by jpt.d · · Score: 2, Informative

    wxWindows provides a nice api that renders using a native method (windows uses windows controls, unlike qt which draws its own).

    MFC is not going to be supported by microsoft now because of .Net (which also means platform lockin).

    I can never recommend qt, because of its wierdness with having a preprocessor of its own. If you could, Objective C would be a nice language to do it in :-)

    --
    What we see depends on mainly what we look for. -- John Lubbock Now search for that bug slave!
  2. Develop in Python, using wxWindows by tdelaney · · Score: 5, Informative

    I can pretty much guarantee that you will be more productive and have your product out the door faster, event if you need to ramp up on both Python and wxWindows.

    Lots more information at:

  3. Write it in MFC, then port to wxWindows by LoveMe2Times · · Score: 3, Informative

    If you are a newbie, then write it in MFC. Porting to wxWindows is easy--I recently ported an MFC project at work to wxGTK on Solaris, and chaning all the MFC calls to wxWindows calls only took a couple of hours for a 2 man-month project.

    If, on the other hand, you are confident with MFC, then just skip it and write straight to wxWindows. Basically, if you write in MFC with VC++, you can use all the class wizard stuff to set up message maps and create stub functions, etc, and it's just faster to get it up and running if you don't know how to do this yourself. Then, you can do easy search and replace to convert to wxWindows. For example, all of your Invalidates become "Refresh," all of your CDCs become wxDC, CString becomes wxString, etc etc. You will have to make a couple of small changes here and there, but search and replace will be 90% of the work.

    If you know how to set up the message maps and whatnot yourself, then just take one of the example programs (it comes with loads of examples) and start modifying to taste. There is really good documentation on the website, although I found the search capabilities cumbersome.

  4. Have you thought about CLX? by xagon7 · · Score: 2, Informative

    CLX is the cross platform version of Borland's VCL which is used in Delphi and C++ Builder. Delphi has a counterpart in Kylix that would allow dual development for both Linux and Windows.. the only downside being you would have to know Delphi (Object Pascal). But it seems as a great multiplatform tool. There are free personal versions of Delphi and Kylix on Borland's website for GPL use, but to distribute a commercial application without the initial popup you would have to purchase one, get someone else to compile them for you, or compile both in Delphi and Kylix. Good luck in whatever you choose.

  5. From what I can tell, I'd say go with wxWindows by Chuck+Messenger · · Score: 3, Informative

    Sounds like you've got a pet project you'd like to develop in order to get your feet wet. Which I heartily recommend. And maybe it will lead to bigger and better things, as time goes on -- maybe even commercial possibilities -- who knows? Or if not, at least it will be fun.

    I've used MFC and wxWindows quite alot. MFC is quite primitive by comparison to wxWindows -- the MFC design is old, and it shows. For example, try making a resizeable dialog in MFC! If you use MFC, you'll be stuck with Windows. Porting the app to wxWindows (or any other GUI framework) will be non-trivial -- you'll be writing from scratch, using your MFC app as a model. Not that that would be all bad -- it's one way to iterate toward a good design. But really, there are faster ways to get to a good design. So, MFC is basically bad, mostly because it ties to you Windows, and secondly because the GUI framework is excessively primitive.

    wxWindows is free. Not GPL -- just plain old free, almost anyway (you'll have to read the fine print -- I think you have to give attribution, etc -- but there is no restriction on selling your creation). That trumps Qt, which is a much GUI framework (on technical merits alone, Qt is hands-down the best C++ framework that I've seen). The problem with Qt is that you must decide up-front whether you're going to create a forever-free (GPL-style) app, or whether you might want to charge for it some day. If you start creating it as a free app, it must forever remain so. What a horrible license. So, for most small-time operators with potential commercial aspirations, that puts Qt firmly out of reach (their developer's license is, or was, around $1000).

    If you go with wxWindows, then by all means you _must_ get wxDesigner - a proprietary GUI builder. I think it's $50-$100 or so (it was $50 when I bought it). What a great program! Once you become fluent with the layout paradigm (which I found to be quite natural), you'll be very productive with it -- much more productive than with MFC.

    Well, I could go on and on.

    A couple of quick thoughts: As someone else pointed out -- you should probably check out wxPython, which makes the wxWindows API available to Python. You'd probably be alot more productive that way -- development with C++ can be very slow (especially on Linux!). If you go the wxPython route, you'll be able to reuse all your GUI design -- wxDesigner can produce both C++ and Python code.

    In short, if you want to have fun, and explore the world of GUI programming, stay away from MFC. It has little to offer. If you want the best, and you're ready to GPL your software, go with Qt, which is the best GUI framework hands-down. If you want to keep your options open, especially in terms of which platforms you want to deliver on, then go with wxWindows (and look into wxPython).

  6. Re:MFC and language extensions by Chris+Hall · · Score: 3, Informative

    #define for if (true) for

    This is a very dangerous definition, as it invites a following else to be misunderstood. For example, it breaks the following:

    if(foo) for(int i=0;i<42;++i){...}
    else cout<<"Oops!\n";

    A better fix is therefore

    #define for if(0);else for

    (Or use false instead of 0 if you prefer, but there are probably still compilers out there that don't understand bools.)

  7. Re:Software Development for the World by bruckie · · Score: 3, Informative
    Why limit yourself to two platforms? Write the back-end of your chess program so that it communicates with a front-end client by passing certain messages (perhaps in XML format). You might even make the message specifications public so that others could write clients for your chess engine.

    There's already a very good solution for doing this: XWT.

    XWT allows you to write the interface in XML and JavaScript, and the XWT viewer then downloads and displays that interface. When computation needs to be done, the XWT interface makes an XML-RPC call to a server.

    In fact, there's even a demo chess program on the XWT site, now that I think about it. :)

    --Bruce

    --
    There are 10 kinds of people in the world: those who understand binary, and those who don't.