Skip to main content

More about WYSIWG GUI Designers and VI Programming

I've not always been blind.

For about twenty years I was a programmer, with a varying level of visual impairment.

Before I lost my sight very quickly in 2008 I had a level of sight which was the same for a long time, although it was gradually decreasing.

What this meant to me as a programmer in the early days of MS Windows was:

  • Keeping track of the mouse-pointer on the screen was tiring and not always easy
  • Using Windows graphical IDEs to design forms was hence not always comfortable for long periods
  • It was easier for me to rough-out a form, for example in MS Access with the IDE and then tweak the code with a text editor

For years I used QEdit, which was a very lovely text editor for MSDOS. I miss it.

Actually losing my sight totally, which made it necessary to embrace the use of a screen-reader made things a bit easier in some ways, and flipped things around a bit:

  • Now using the GUI on either MS Windows or Linux was easier, assuming the applications used are accessible

But, now using a drag-and-drop GUI designer was no longer possible, or at least not easy.

GUI Programming using Absolute Positioning

I used to write applications for MS Windows in vanilla C, using the native Win32 API calls.

That involved either generating controls with calls to CreateWindow and it's variants or by using resource (.rc files).

That made programming once I lost my sight difficult because:

  • I could no longer tell if my controls were all lined up correctly vertically and horizontally
  • My head was spinning with arithmetic every time I tried to size and position one control relative to the previous/next one

This approach, using absolute positioning also falls down when another user is not using the same sized font as you, or when the user clicks and drags the corner of your window to resize it. The formatting goes all to pot and looks like a dog's breakfast.

But more recent development tools have started using sizers.

In the sizer approach, controls are added to a kind of invisible net which controls the positioning.

Visualise it like this:

  1. There is a clear flat surface in front of you
  2. You need to place objects on that surface ina controlled way
  3. Imagine an invisible shield which is floating a couple of inches above the surface
  4. Cut into that shield are a number of holes through which you can place the objects on the surface
  5. When the objects are placed, changing the size of the surface will cause the invisible shield to change size as well and the objects will move and resize in a known and predictable way

I know of several GUI toolkits and languages that do this:

  • GTK, on Linux, and (I think) Windows and Mac
  • wxWidgets, multi-platform
  • wx.Python, multi platform
  • Java, multi platform

Varieties of sizer

Each of these tools has a variety of sizer types. Here is a by-no-means exhaustive list of them and a description of each:

Box Sizer

In either horizontal or vertical variants. Controls added either stack across (horizontal) or down/up (vertical).

Grid Sizer

A number of variants exist but essentially an X and Y grid of cells which are filled with controls by specifying their coordinates.

Sizers within Sizers

It is possible to add a sizer to another sizer to create complex GUIs.

For example if your form had a horizontal box sizer into which you have placed two vertical box sizer sizers, you will get left and right vertical sizers.

I know this explanation sounds complex but it really not.

One thing to remember is that the parent of a control is NOT the sizer into which it is placed but the object, usually termed something like panel, to which the sizer containing the control is added.

Using these sizer objects to position controls you will get:

  • A window which handles resizing and font changes correctly
  • A much easier life with no absolute-positioning headaches like arithmetic-overload

Sizers usually have some properties which control the way controls placed upon them will expand, contract and position themselves when the window is stretched or shrunken.

I still don't find WYSIWYG/drag-and-drop form designers very easy, or even possible to use, being totally blind, but the sizer approach has given me back a way to write complex and visually pleasing applications even though I can't see.

And of course the sighted authors of drag-and-drop IDEs tend to either just ignore accessibility, or assume that using them when you can't see is impossible. So keyboard shortcuts may not be included.

My personal favourite toolkit at the moment is wxWidgets, which is giving me a way to teach myself C++. Previously I stuck to C like a limpet.

I have yet to get to grips with:

  • GTK programming in C
  • Qt

Talking of Qt I believe accessibility is improved in version 5. It's been getting better and better. And now my C++ is coming on apace I will take a look at it.

All this is very exciting for the visually impaired programmer in a world where it is not as acceptable any more for an application to only run on one platform.