Thursday, November 11, 2004

318.aspx

#egilh project 12: UI hotkey checker

When: Mid 90s


What: Duplicate hotkey checker for menus and dialog boxes


While localizing software it's easy to make mistakes. I covered some of them in the Windows 95 post. A common issue in crowded menus and dialogs are duplicate hotkeys. Especially as the development team continues to change the menus and dialog boxes.


Finding them in testing is difficult for several reasons:



  • It is difficult to bring up all the possible dialog boxes. Some of them are only displayed with special hardware or in special conditions like 'low on disk space'.
  • You have to pay a lot of attention. It is hard to spot duplicate hot keys in a crowded dialog box. It is even harder to spot truncated text as labels may 'word wrap' or truncate at a natural point.

The good news was that all menus, dialogs and strings (selected by the developers) were stored in the 'resource section of  .exe, .dll, etc files. Visual Studio etc can open the files to view and edit the resources. Win32 introduced the resource APIs which made it possible to access the resources without having to parse the file structures documented in MSDN.


Using the new features of Win32 and some file format info I wrote a tool that extracted all the menus and dialog box and cycled through all the items in each file and generated a report of all the errors. The hotkey for each item (preceded by a &) was compared against all the other hotkeys in the same dialog box. Menus were a bit more complex as it also checked against the parent menu.


A completely automatic system like the one I implemented catches all the cases above, but it is not perfect as it is not able to catch bugs in menus/dialog boxes generated at runtime. My boss later wrote a window monitor that checked windows displayed on the screen at runtime.


Lessons learned:



  • Windows resource APIs and resource file formats

No comments:

Post a Comment