Posts Tagged ‘gui’

Fox Toolkit – why it sucks, and why you should stay away from it

11/08/2009 1 comment

My second warning to the world after ‘Travian‘ – the horrible online game where you get to be bullied up your back hole by groups of strangers, is about the GUI library by Jeroen van der Zijp – Fox Toolkit.

You can feel free to look for info about it on the net if you’re interested, because I’m not going to advertise it anymore than I already do. Let me just say that never in my life have I ever had to deal with such an undocumented, cryptic, oddly behaving library.
I chose it back in 2004 for a test project, meaning to use it as practice for my C++ skills. Since then, that pet project had become quite a nice audio player that I use on a daily basis. Unfortunately, it’s also at a point where rewriting it from scratch is just too much work, so I’m stuck with Fox toolkit.

So much for the exposition. Let’s move on to the warning itself:

Jeroen doesn’t just like to do things his way – he also makes it sure only he knows what the hell they are doing.

Example: The documentation for an FXOptionMenu is “Option Menu”.
Great! When you click on ‘more’, you get this additional informative text:
Detailed Description: Option Menu.”
Thanks, buddy! For those of not blessed with telepathy, some helpful words, or a screenshot, would’ve helped..

I know it’s being given for free, but for god’s sake – no examples to be found, a message board that contains very few actual answers to bugs I encountered (Why does a popup window corrupt my entire screen view?! Ah, right, because there’s a target for notifications, but the selector is zero/NULL – did that make sense to you? me neither, but it took me a good while to figure out this obscure problem).

Moreso than that, since the project is maintained, as far as I could tell, only by this one courageous soul, he doesn’t have the time, nor the patience, to deal with all the requests, complaints, and oddball queries.
That is understandable, but be warned all of you – your question may not be answered, or you’ll get a reply along the lines of “that’s the way it is, stupid”, like many others before you.

Forget 3rd. party documentation. In fact, forget documentation at all. I had to read through the source code so many times just to know what a function does, and then try to rewrite it because the base class couldn’t be modified easily.
Speaking of base classes – trying to extend FXTable was virtually impossible – because there was no way to find which of the many virtual functions needed to be reimplemented, and which didn’t.

I’ll have to commend no other than Microsoft now. Yes yes – the big devil from Redmond was smart enough to realize that some people want a table in which you can select whole rows, not just cells! But forget about it in fox-toolkit. ‘Not a popular way of using the widget’ says the author.
With tables in .NET this is but a simple change of a variable. Roughly 3 seconds of work.
Took me a day to figure out how to do this thing in fox. When I was finally done, it felt cathartic – like breaking out of a North Korean prisoner camp!!!

And another, more prominent problem – the maker of fox-toolkit does not like the STL. That’s right, he’s implemented his own strings, vectors, linked lists, and so forth. He’s even gone as far as to advise people not to use the STL.

This isn’t 1998 anymore! If, like me, you happen to like the STL, or any library that builds upon it, you’re going to find yourself mixed up in a lump of FXString, string, and plain old char* conversions, and speaking of FXString – it uses its own terminology (without further explanations, of course): what is a ‘section’? Where is ‘substring’? Oh right, it’s ‘mid’. Makes perfect sense. I guess it’s very hard to type ‘middle’, but then what is ‘find_first_not_of’ doing there?

I’ve had the doubtful privilege to worked with many GUI libraries in my life, and I know one basic fact:
When it’s time to choose a new library to work with – make sure it is well documented, has a responsive developer base / community, and has available examples you can learn from
In case of a graphical library, make sure there are working demos/examples/programs of the widgets, with source codes that show their functionality.
This way, you won’t have to waste too much time of your life trying to implement missing functionality that other people get for free because they picked the right tools from the start. They will read the documentation, and change a variable in a function, while you’ll be rummaging through obscure source code for hours.
What does an FXFooBar does? Well, you can’t tell. How do you know it’s only supposed to go in an FXBoolBlap, and not in a layout of type FXBullShat? That’s right – you don’t, until you figure it out on your own.

And by the way – it just gets worse with the more recent versions. Why were the functions in FXFile split to four different classes? How about keeping some kind of reference to them? Why do we need to play Indiana Jones trying to find where the missing magical functions went?
And really thanks for the unicode support – now all the Hebrew that I used to see automatically turned to question marks, and unicode Hebrew became Chinese. It might be a simple thing to fix that – if you’re Mr. van der Zijp. Otherwise – good luck with figuring out the unicode library! It makes the ancient winapi functions look like pure fun!
You know what was easier than figuring out why the unicode doesn’t work anywhere? That’s right – going back to the non-unicode version of the library that I used years ago, scrapping days of effort in the process.

I know I’ll never pick Fox Toolkit ever again, and if you guys know what’s good for you, you wouldn’t either. I can recommend two others right off the bat – FLTK (Which is more innovative, compact, and easier to understand), and WxWidgets (Which is massive, but at least well documented!).
Or even write your own, like I did once with a game I’ve built. That would be much less frustrating, because you’d at least know where the bugs are coming from.

My advice – avoid, unless frustration makes you feel alive.

Categories: General