Revision of Time to reimplement Vision2 from Thu, 07/12/2012 - 11:37
The revisions let you track differences between multiple versions of a post.
I have been using Vision2 a lot over the past 5 years across a number of projects and have become aware of many idiosyncrasies in it's behavior between the GTK and Windows implementation that make it difficult to have consistent behavior in your application. This is especially true if you want to develop any kind of customized component but even some quite basic things have inconsistent behavior.
Examples of custom components
- Buttons based on SVG graphics with roll over highlighting and customizable click animations.
- Boxes with auto-hiding on selected member widgets. When you roll the cursor over the box, various hidden widgets reappear, and disappear again when the cursor leaves.
- Labels with a pixmap-able background based on drawing areas.
- Hyper-link labels based on drawing areas.
- Color selection buttons.
- Drawing areas that can adapt their own size to an expanded parent cell.
Examples of basic inconsistencies
- Pixmap have a different expansion status in Windows then under GTK necessitating an explicit set_minimum_size call.
- Scrolling areas don't respond to the usual keyboard shortcuts in Windows. I made my own Windows implementation based on the standard one. It's ok, but not without side effects that have to be worked around. Recently I had a case of child buttons that wouldn't respond.
- The web browser component in Windows prevents processing of keyboard accelerators.
The typical Vision2 cross platform development cycle consists of developing some new functionality on Linux and after recompiling your project in Windows, you find that a component is either: not visible, not aligned properly, has the wrong expansion status, is partially obscured, won't respond to the usual keyboard shortcut, breaks a contract, or even crashes the application. You then spend some time finding workarounds and then go back into Linux to see if your application still works the same there. In some cases I have spent days trying to get a custom component to work consistently on both platforms.
Vision2 has had a long history (15+ years) but it is still far from perfect. This I believe is a reflection of the fundamental difficulty of developing a totally consistent GUI interface based on incompatible toolkits.
However it doesn't have to be like that. For quite some time now, it has been possible to develop GTK+ applications that run on Windows, Mac OS and mobile devices. (Screen shots) And not just relatively simple apps like Gedit, but very complex ones like GIMP or InkScape.
Now that Eiffel Software have sanctioned the mingw as the default C compiler distributed with EiffelStudio, perhaps now is the time to jettison the Win API part of Vision2 and base it entirely on GTK+. (In fact you can still use the MS compiler for GTK+) The main advantages of an entirely GTK+ based toolkit are as follows:
- Ensures completely consistent cross platform behavior.
- Maintenance and bug fixing becomes much easier due to reduced complexity.
- Addition of new GTK+ components becomes easier.
- Encourages more Eiffel developers to contribute custom components by reducing the work and complexity. It now becomes possible to make new widgets using only the top level interface. Struggling with two very different C API's is no longer necessary.
- Reduces the likelihood of problems using mingw as the default C compiler.
Does anyone agree with these views?
Happy Eiffeling Finnian