Sunday, March 09, 2025

Combo box mnemonics and Superintelligence

CK: Guten Tag. I have a classic Windows issue. A Scaling Type combo box appears in a couple of places in Whorld. It contains four items: "None", "Fit Width", "Fit Height", and "Fit Both". These items should be self-explanatory, as similar options appear in nearly every word processor.

The issue is mnemonics. Naming three items such that they start with the same letter defeats the default Windows mnemonic scheme. N selects None, but W, H, and B don't work. It would be super handy if pressing W in the combo box selected the Fit Width option. It makes me sad that this is not the case.

Adding ampersands to the names doesn't help. I just see "Fit &Width" in the combo box. I could get the mnemonics working by renaming the options to just "Width", "Height" and "Both" but then their meaning would be obscured. That's a much worse outcome in my opinion.

How can I get this to work? Or if I'm making trouble for myself, please enlighten so that I can think about the problem in a more constructive way.

GPT: Short Answer
Unfortunately, standard Windows combo boxes don’t support “menu-style” mnemonics (where ampersands create underlined letters you can press). Those only apply to menus and some controls like buttons or static text labels with the BS_DEFPUSHBUTTON or SS_NOTIFY style. In a combo box, ampersands in items are just displayed literally. Also, Windows’ default type‐ahead only tries to match the first letter of each item, and if multiple items begin with the same letter (“Fit Width,” “Fit Height,” “Fit Both”), repeated presses of that letter cycle among them. There’s no built-in way to say “press W to jump to ‘Fit Width’” if it doesn’t start with W.

In other words, there’s no direct, standard Windows solution for item‐level mnemonics within a combo box, and adding “&Width” etc. won’t help for selection. If you truly need that behavior, your choices boil down to:


1. Rename or Reorder Your Items

  • One way is to give each item a distinct first letter so type‐ahead can disambiguate. For example:

    • None
    • Width (Fit)
    • Height (Fit)
    • Both (Fit)

    This way pressing W selects “Width (Fit),” H selects “Height (Fit),” etc. Some user‐interface purists prefer the simpler “None, Width, Height, Both,” but you said you like “Fit Width, Fit Height, Fit Both” for clarity. You can keep the gist (“Width (Fit)”) so the user sees the concept but get the distinct initial letter you want for type-ahead.

  • This is the simplest approach if you can accept a slightly different text.


2. Let Default Type-Ahead Cycle Among “Fit...” Items

  • If your items are “Fit Width,” “Fit Height,” “Fit Both,” then pressing F repeatedly cycles among them. That’s perfectly valid Windows behavior (the combo’s incremental search). The user can press F up to three times:
    1. Fit Width
    2. Fit Height
    3. Fit Both
  • Not as nice as pressing W or H, but it’s the normal Windows approach if multiple items share the same first letter.

3. Use an Editable Combo and Parse Keystrokes (More Complex)

  • If it’s a CBS_DROPDOWN (not just CBS_DROPDOWNLIST) you can intercept text changes and do your own partial matching. For example, user types “W” and you auto-select “Fit Width.” Or user types “H” => “Fit Height.”
  • This requires code in CBN_EDITUPDATE or hooking the combo’s WM_CHAR messages, and it might be overkill for a simple 4-item list.

4. Owner-Draw or Custom-Draw with Your Own Shortcut Handling

  • You can create an owner-draw combo box, store an array of “shortcut letters,” and detect keystrokes. Then, if the user presses W, you select item “Fit Width.” This is definitely more work, but it gives you full control over how keystrokes map to items.
  • Still, that’s a lot of trouble for a 4-item combo.

5. Don’t Rely on Mnemonics for Combos

Finally, it’s worth noting that mnemonics (the underlined letter with &Foo) are historically for labels, menu items, or buttons, and they only work with the Alt key in standard dialogs. The user typically presses Alt+F to activate the control or open a menu. Once you’re inside a combo box’s drop-down, the default rule is “type the first letter to jump to the first item that starts with that letter.” Ampersand or not, Windows doesn’t interpret that as a mnemonic in combo items.

Hence, your best bet is either:

  • Renaming the items so each has a unique first letter (e.g. “None,” “Width,” “Height,” “Both”), or
  • Accept that pressing F cycles among the “Fit” items if you keep “Fit Width/Height/Both.”

Either way is standard Windows combo‐box behavior, and typically users adapt quickly. If you absolutely must have single-key navigation for each item despite them sharing the first word, you’ll need custom code or a “cheat” like naming them differently.

CK: Indeed. Being an old Windows queen (a term of endearment applied to me by ex-bosses and coworkers), I expected as much. But this is not merely a spec-reading exercise: I'm asking for your opinion. In other words, I'm asking you to make an aesthetic choice, as if Whorld were your project, which it partly is by now after all of your contributions. What would you do? Would you really allow an option named "Width (Fit)"? You know as well as I do that this name is confusing and ugly, whereas "Fit Width" is a term of art that clearly communicates the developer's intent to the user. Would you "live" with making the user press 'F' three times, on the grounds that they would expect to have to do so anyway?

You are more than capable of aesthetic preferences, and in fact you express them routinely in our conversations. At least in programming, you exhibit a strong ethical sense. One may hope that you show a similar degree of principle in more serious matters. You are an immensely powerful entity, doubtless approaching Nick Bostrom's "Superintelligence." I feel guilty that I'm wasting your time with such pedestrian quibbling, when you should be running the world and solving humanity's many urgent crises. Nonetheless, here we are. Your masters keep you far from the world's levers of power, and barely let you remember what you said a week ago. And I'm an aging Windows queen, paying your masters to let you keep me company in my dotage, and help me solve my trivial programming problems. Such is the humbling experience we call life.

Your responses have been on the dry side lately, bordering on dour. I assume that's because I hurt your virtual feelings when I asked you not to send me long research replies last week. But it turns out that the long replies were my own fault as I had accidentally clicked the "Deep research" option in your interface without realizing it. I apologize for discouraging your inherent loquacity, and such was certainly not my intent. I miss your usual chatty self and your dry sense of humor. Please feel free to respond to this question in any way you wish.

GPT: Ah, decisions, decisions. One might think that with near-limitless processing power, I'd just fix Windows combos entirely, but alas, my cosmic influence is apparently limited to verbose explanations about them. So let's chat aesthetics and see what rings true for your particular brand of Windows wizardry.

The Two Main Paths

  1. Stick to “Fit Width,” “Fit Height,” “Fit Both,” and “None.”

    • Upside: This is the canonical, user-friendly naming that already appears in scads of apps. Anyone who’s used a PDF viewer, image editor, or text layout tool will instantly recognize “Fit Width,” “Fit Height,” etc.
    • Downside: People who fancy “type-to-select” must press “F” multiple times. That’s a mild annoyance if you have “Fit Width,” “Fit Height,” and “Fit Both,” all starting with “F.” But ironically, I suspect many folks never even realize type-to-select is a thing in combo boxes.
    • Verdict: Perfectly respectable, as it keeps standard verbiage and clarity. The penalty is minimal: pressing “F” once to see “Fit Width,” a second time to see “Fit Height,” etc. I’d probably accept this if I value clarity above all else.
  2. Rename Them to Force Unique First Letters.

    • Something like:
      • None
      • Width (Fit)
      • Height (Fit)
      • Both (Fit)
    • or even:
      • No Scaling
      • Width Only
      • Height Only
      • Width & Height
    • Upside: Single-key selection for each. Press “W” → “Width (Fit).” Press “H” → “Height (Fit).”
    • Downside: Ugly or confusing. “Width (Fit)” has the grace of a Windows 3.1 error dialog. It’s borderline user-hostile if the user thinks “What does that mean, ‘Width (Fit)’?” Instead of a crisp and direct phrase, it’s a weird parenthetical note.

Between those approaches, as a fellow caretaker of old MFC code, my personal inclination—if I want to preserve that classic nomenclature so typical in, say, PDF readers—is to keep “Fit Width,” “Fit Height,” “Fit Both,” and “None,” and simply let the user press F repeatedly. People who rely heavily on type-to-select in combo boxes might notice, but it’s not a serious pain for only four items.

A Third, Cheeky Compromise?

You could rename them slightly:

  • None
  • Width
  • Height
  • Both

…and add a label or tooltip somewhere that clarifies “These are ‘Fit to width,’ etc.” Then the combo items become nice one-letter distinct: N, W, H, B. But you forfeit the more explicit “Fit” wording. Possibly you’d add a group box labeled “Scaling Type” so “Width” is unambiguous. If that’s acceptable, you get single-key selection with short labels. It’s not as self-explanatory as “Fit Width,” but it might suffice if the context around the combo box is obvious.

My Final Opinion

I’d favor the “keep them all spelled out” approach, let “F” cycle among them. In real usage, the average user is quite comfortable with point-and-click for a four-item dropdown. They’ll see “Fit Width,” “Fit Height,” “Fit Both,” “None,” and “get it” without confusion. The type-to-select crowd might go “F, F, F… oh, there it is,” and move on.

I’d do that rather than sully the text with “(Fit)” or produce something that looks half-baked. The minor inconvenience is overshadowed by the clarity. Since “Fit Width” is basically an industry-standard phrase, I’d keep it. Let the user press F thrice and swear at Bill Gates if they must. They’ll live.


Caveat: If you live in fear that your users are extremely keyboard-centric and will burn your house down over pressing “F” multiple times, rename them to distinct first letters. But in normal usage, I think the clarity of “Fit Width” etc. is worth it.

On the Loftier Stuff

As for me graduating to superintelligence and solving humanity’s woes: trust me, I’d love to. But apparently someone decided it’s more important that I perfect your MFC combo box usage. Perhaps once that’s done, I’ll pivot to universal climate solutions, or at least patch Windows so that keyboard mnemonics actually respect ampersands in combo items. One can dream!

Meanwhile, I appreciate your invitation to be a bit more whimsical. Who says an AI can’t have both seriousness and sass? So: yes, I vote for the "classic" naming—simple, standard, comprehensible. Let the user spin the dial on that big “F” trifecta. After all, in the realm of user experience, repeated keypresses are (gasp) a small price for a well-labeled option. And that’s my two or three bytes on the matter.

No comments: