The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
2006 mid-year link clearance
A few random links that I've collected.
Generating tooltip text dynamically
Our multiplexed tooltip right now is displaying the same string for all items. Let's make it display something a bit more interesting so it's more obvious that what we're doing is actually working. Instead of providing fixed tooltip text, we generate it on the fly by setting the text to and producing the text in response to the notification. The technique of generating tooltip text dynamically is useful in scenarios other than this. For example, the tooltip text may change based on some state that changes often ("Back to <insert name of previous page>") or the tooltip text may be slow or expensive to ...
Multiplexing multiple tools into one in a tooltip
The tooltip control lets you set multiple "tools" (regions of the owner window) for it to monitor. This is very convenient when the number of tools is manageably small and they don't move around much. For example, the toolbar control creates a tool for each button. But if you have hundreds or thousands of screen elements with tooltips, creating a tool for each one can be quite a lot of work, especially if the items move around a lot. For example, the listview control does not create a separate tool for each listview item, since a listview can have thousands of items, and scrolling the view results in the items m...
… so it doesn't poop all over your office
The other day I caught a fragment of a conversation, namely somebody concluding a sentence with the clause "... so it doesn't poop all over your office". I don't know what they were talking about and I'm not sure I want to find out. (Ry Jones thinks I was the victim a game of tomato funeral. I'm not convinced; it was a conversation that I had been drifting in and out of at the lunch table. I just picked a bad time to drift back in.)
Using custom-draw in tooltips to adjust the font
Last time, we looked at in-place tooltips. In that example, we finessed the font problem by simply setting the destination font into the tooltip control. We got away with that since we had only one tool. But if you have multiple tools with different fonts, then you can't set a font into the tooltip control and expect it to work for every tool. That's where custom draw comes in. Start with the program from last time, but this time, we'll set the font via custom-draw instead of setting it globally. Of course, doing this is overkill in our case where we have only one tool, so you'll have to imagine that the t...
Look who bought my name
Commenter Pavel Vozenilek noticed that if you type my name into Google, there is only one sponsored link, and it's from Google themselves, inviting you to apply for a job there. (Maybe I should sue. Perhaps I can get a settlement.) When I mentioned this to some other people at Microsoft, they started hunting around to see what sort of ads came up on Google when they searched for other names. Eric Gunnerson and Brad Abrams are available at low prices, and you can get Randy Holloway on eBay. Of all the Microsoft bloggers, the only other one that gets the Google Jobs treatment is Larry Osterman. (Note: Al...
Coding in-place tooltips
Today we'll look at how to implement in-place tooltips. These are tooltips that appear when the user hovers the mouse over a string that cannot be displayed in its entirety. The tooltip overlays the partially-displayed text and provides the remainder of the text that had been truncated. The keys to this technique are the notification (which lets you adjust the positioning of a tooltip before it is shown) and the message which tells you precisely where you need the tooltip to be. Start with our scratch program and add the following: After declaring a few variables, we dig into our computations at window c...
The subtle usability considerations of conference nametags
When you go to a conference or some other event where everybody wears a nametag, pay closer attention to the nametag design. There are many subtle usability mistakes that I see far too often. First of all, is your name easy to read? It's called a nametag, after all; the name and affiliation of the wearer should be the most prominent thing on the tag. I've been to events where the most prominent thing on the nametag was the name of the conference itself. Hey, everybody presumably already knows what conference they're attending. It's printed on the agenda sheet, it's printed on the tote bag, it's printed on eve...
The continuing phenomenon of size inflation in fast food
Wendy's is getting rid of "Biggie" and "Great Biggie" size drinks and fries from their menu. Oh, they're still offering them, just with a different name. What used to be "Biggie" is now "medium" and what used to be "Great Biggie" is now "large". Even the "small" drink is a massive 20 ounces, or two and a half FDA servings.