Last updated:
5. Apr 2005

User Interface Programming

(Start main menu) Home ­ Articles ­ Book ­ Resources (End main menu)

User Interface Programming Column


(Start sub-menu)

Java

User Interface Programming Column

Features

Tech Tips

Reviews

Code Archive


Range Slider

Splitter Controls and Dialog Resizing


 

Feedback…

My blog »

(End sub-menu)

User Interface Programming is the name of a monthly column I used to write for Win­dows De­vel­oper Maga­zine. The column was devoted to user in­ter­fa­ce issues that Win­dows pro­gram­mers face; the “pro­gram­ming” in the title means that the column was hands-on and involved code.

I had three goals for each column:

  1. To teach you something new and useful about Win­dows pro­gram­ming;
  2. To provide you with useful code you can reuse “as is”;
  3. To point out errors, bugs and omissions in the Win­dows UI.

Most of the code for these columns is in C rather than C++, on the theory that C is accessible to a larger number of readers. (Besides, the key point rarely de­pends on C++ fea­tures.) If you disagree, let me know.

The columns are listed in reverse chrono­logi­cal order (newest first).


27 Revival of the Fattest

Windows De­vel­oper Maga­zine, December 2002

In search of the Un­holy Grail or Why Web App­li­ca­tions are Evil

Technology like the Windows Installer combined with .NET assemblies makes deploying feature-rich fat clients practical.

This article is available online. You can also read it on the WDM web site.

26 An App­li­ca­t­ion-crashing Windows Bug

Download Code
Read Article

Windows De­vel­oper Maga­zine, No­vem­ber 2002

Analyzing an elemental user interface conflict involving the User32 library.

You can read this article on the WDM web site.

25 UI in the Time of XP

Download Code

Windows De­vel­oper Maga­zine, July 2002

With a few modifications, you can get your specialized interfaces to adopt Windows XP’s user interface “themes.” Note that this stuff works only under XP.

I found the MSDN sample application Theme Explorer useful for exploring XP themes, but am no longer able to find it. If you know where it went, please drop me a note.

24 The Splitter Con­t­rol

Download Code

Windows De­vel­oper Maga­zine, June 2002

The Poor Man’s Split Bar isn’t up to complicated tasks. Here’s a full-featured replace­ment – a con­t­rol that will divide a dia­log into any number of freely resizable panes.

23 The Amazing Vanishing Message Box

Download Code

Windows De­vel­oper Maga­zine, April 2002

If an application displays a mes­sage box saying “Device Not Ready; Retry, Cancel?” and the device in question does become ready before the user acts, the mes­sage box should go away of its own volition.

This column explains one or four ways of achieving this. improving on a simple “device not ready” dia­log box by eliminating the need for clicking on the “Retry” but­ton to dismiss the mes­sage. There are several ways to create a “smart” mes­sage box, but this solution should be easier to maintain.

22 Make it Snappy

Download Code

Windows De­vel­oper Maga­zine, February 2002

When you move a win­dow, all destinations are not equally likely. This column shows how to make a win­dow snap to the edge of the work area when it gets sufficiently close. It also shows how to confine a win­dow to the working area of the screen.

21 Resizable Dialogs Revisited

Download Code
Read Article

Windows De­vel­oper Maga­zine, January 2002

Group boxes are weird things that can behave strangely during resizing. In this column I investigate a transparency problem submitted by a reader. The solution involves fiddling with style bits, and reveals just how complex a windowing system can be.

20 Home on the Range Slider

Range Slider
Download Code

Windows De­vel­oper Maga­zine, December 2001

The range slider is an old idea that for some reason hasn’t been widely implemented. This column provides a fully working range slider that’s easy to use, along with some commentary on well-behaved con­t­rols.

The con­t­rol described in the column is fairly simple. The version documented here is better.

19 The Wait Cursor

With the No­vem­ber 2001 issue, Win­dows De­vel­oper’s Jour­nal changed its name to Win­dows De­vel­oper Maga­zine.
Download Code

Windows De­vel­oper Maga­zine, No­vem­ber 2001

The wait cursor provides important feedback for the user during lengthy op­er­ations. But if the mouse is moved in the meantime, restoring the right cursor rather than the original provides polish to your UI. And sometimes the best wait cursor is none at all.

18 Edit Field Validation Strategies

Download Code

Windows De­vel­oper’s Jour­nal, October 2001

Guidelines for building user input validation into your programs.

17 Edit Hinting Revisited

Download Code

Windows De­vel­oper’s Jour­nal, September 2001

This one follows up on a previous column about “edit field hinting” and provides some alternative approaches to the problem of using empty edit fields to display hints for their usage.

16 Automatic Scrolling

Download Code

Windows De­vel­oper’s Jour­nal, July 2001

This month’s column continues the examination of scrolling, and what parts of it can be encapsulated in reusable code. After fixing some bugs and improving last month’s code architecture, I look at automatic scrolling. For example, if the user is drawing a rubber-band line and drags the cursor past the bottom of the win­dow, you want the win­dow to automatically scroll up to reveal more area.

15 Scrollbar Handling

Download Code

Windows De­vel­oper’s Jour­nal, June 2001

Most code to handle win­dow scrolling looks very similar, so it ought to be possible to extract the relevant code into something reusable. That’s what this month’s column does, with some looks at Win­dows scrolling bugs and mouse wheel scrolling along the way.

14 The Poor Man’s Split Bar

Download Code

Windows De­vel­oper’s Jour­nal, May 2001

See also the split bar con­t­rol.

Splitter windows let the user con­t­rol how to divy up the space inside a frame win­dow. Splitters can represent a lot of complicated code, but they can also be downright simple, as this column demonstrates by turning a dia­log box into an Explorer-style win­dow.

13 Edit Hinting

This code was later upgraded to deal with some problems pointed out by readers.

Frankly, this whole writing racket would be much simpler without readers. (Joke!)

Download Code

Windows De­vel­oper’s Jour­nal, March 2001

An edit con­t­rol label provides some hint about what the user’s supposed to enter, but not much. One solution is a content hint—explanatory or example text that appears initially in the edit con­t­rol, but then disappears when the user starts to actually enter content. This can be a slick solution—if you can im­p­le­ment it right.

12 Reader Feedback

Download Code

Windows De­vel­oper’s Jour­nal, February 2001

This month’s column is devoted to reader feedback and loose ends. The Pocket HTML con­t­rol gets a W2K fix. James Holderness writes in to discuss the strange DrawAnimatedRects() documentation. Daniel W. Mathiasen writes of the evil TerminateThread(). I discuss the right way to handle CBN_SELCHANGE. Neil J. Rubenking inquires about AnimateWindow()’s AW_BLEND flag under Win98.

11 The Borderless Combobox

Borderless Combobox
Download Code

Windows De­vel­oper’s Jour­nal, January 2001

A combobox is just an edit con­t­rol and a listbox put together, so it should be easy to do anything to a combobox that you can do to an edit con­t­rol or a listbox. If you’ve tried this much, you know that statement is often com­pletely false. This column looks at how you would accomplish the simple-sounding task of changing the height of the combobox’s edit con­t­rol.

10 File Name Input Fields

Download Code

Windows De­vel­oper’s Jour­nal, December 2000

Last month’s column examined the new auto­com­ple­t­ion and auto­sug­ges­t­ion fea­tures for lists. This month’s column explores the detailed fea­tures for file­name auto­com­ple­t­ion, and supplies an example of what you have to do to make an edit field a drop target for files dragged from Explorer.

9 AutoComplete

Download Code

Windows De­vel­oper’s Jour­nal, No­vem­ber 2000

The latest shell32.dll gives you some new fea­tures for saving users some typing: autosuggest and autocomplete fea­tures. This column demonstrates both fea­tures, pointing up some warts in the documentation and implementation along the way.

8 Resizable Dialogs

One year later:

Group boxes, tab con­t­rols and other “transparent” con­t­rols present a special challenge, which I discuss here.

Download Code

Windows De­vel­oper’s Jour­nal, October 2000

Resizable dialogs let the user change the default size to see more data, in a listbox or edit con­t­rol, for example. A feature-rich layout manager requires a lot of code to do right, but here’s a modest implementation that can easily handle automatic dia­log resizing for most situations.

7 Fixing Combobox Problems

Download Code

Windows De­vel­oper’s Jour­nal, September 2000

A combobox is supposed to let you either select from a listbox, or enter a new item in an edit con­t­rol. Un­for­tu­nately, under some circumstances, text that you type into the edit con­t­rol disappears when you hit Enter. Here’s a fix that uses global subclassing to remedy the problem without requiring any changes to your existing dia­log procedures.

6 Multithreading in the UI

Download Code

Windows De­vel­oper’s Jour­nal, July 2000

Although no longer an absolute requirement, the Win­dows win­dow messaging model still has a strong single-threaded orientation. This column looks at some of the issues you should think about when you decide to involve more than one thread in your user in­ter­fa­ce, and includes a dia­log that uses a background thread to update information from the Internet.

5 Animated Rectangles

Download Code

Windows De­vel­oper’s Jour­nal, June 2000

One aspect of the user in­ter­fa­ce you probably don’t think much about is win­dow creation—windows just appear, right? However, how they appear can give the user visual feedback about what caused them to appear, and where they appear on the screen can also affect usability. This column looks at win­dow animation and win­dow positioning.

4 The Historical Combobox

Download Code

Windows De­vel­oper’s Jour­nal, May 2000

The standard con­t­rols are the workhorses of Win­dows user in­ter­fa­ce pro­gram­ming, but they lack some obvious fea­tures that many programs need. This month’s column adds a much-needed history feature to the standard combobox con­t­rol.

3 Default But­ton Handling

Download Code

Windows De­vel­oper’s Jour­nal, April 2000

The default but­ton is a great convenience for users, but it’s easy to end up with a dia­log that sometimes contains a disabled default but­ton, or paints a but­ton as though it were the default, even though it isn’t. This column explores these problems and provides reusable code to help keep your dia­log’s use of default but­tons correct.

2 Window Subclassing

Windows De­vel­oper’s Jour­nal, March 2000

Download Code
Read Article
Subclassing windows is looking
Easier every day;
The difficult part is unhooking
When someone is in the way.

To really reuse or build upon existing GUI code in Win­dows, you almost always need to use some form of win­dow subclassing. This column looks at various forms of subclassing and provides a small library that provides safe (as safe as possible, anyway) subclassing.

You can read this article on the WDM web site.

The subclassing library is reused in many later columns. It has been upgraded once, in connection with Edit Field Hinting.

1 The Pocket HTML Con­t­rol

Russ Freeman has developed QHTML, which is considerably more powerful than the Pocket HTML Con­t­rol.
Check it out here.
Download Code

Windows De­vel­oper’s Jour­nal, February 2000

How to subvert a static con­t­rol to make it understand selected HTML tags such as <b> and </b>.

This column is in C++ rather than straight C, mostly because the std::string class greatly simplifies the HTML parsing.


(Start bottom menu)

TopHomeArticlesBookResources
Win­dows De­vel­oper Maga­zineR&D BooksCMP Books
Amazon.comAmazon.co.ukContact Petter Hesselberg

(End bottom menu)

Windows Developer Magazine

WDM has merged with Dr. Dobbs Journal.