Showing results for Code - The Old New Thing

Aug 26, 2003
0
0

Rotating the Z-order

Raymond Chen
Raymond Chen

Sometimes you run into a conflict where you need the controls laid out in one Z-order to get hit-testing to work, but need a different order to get keyboard TAB order working. For example, consider this dialog template, which has been simplified for expository purposes. The ...

Code
Aug 21, 2003
0
2

The secret life of GetWindowText

Raymond Chen
Raymond Chen

GetWindowText() is more complicated than you think. The documentation tries to explain its complexity with small words, which is great if you don't understand long words, but it also means that you're not getting the full story. Here's an attempt to give the full story. How windows manage ...

Code
Aug 15, 2003
0
0

Answer to exercise

Raymond Chen
Raymond Chen

The WM_SIZING handler intercepts only interactive resizing. If the user right-clicks the taskbar and selects "Cascade Windows", this resizes the window directly without going through the interactive WM_SIZING step...

Code
Aug 13, 2003
0
0

Scrollbars part 8 – Integral interactive resizing

Raymond Chen
Raymond Chen

Enforcing integrality solves the fractional-line problem, but notice that when you grab the top or bottom edge and resize the window, the resize feedback doesn't match the actual window you get back if you drag the window to a non-integral size. (You may need to turn off full window drag to see this effect more...

Code
Aug 11, 2003
0
0

Scrollbars part 7 – Integrality

Raymond Chen
Raymond Chen

If you play around with resizing the window, you can get a fractional line to appear at the bottom of the screen. This is not normally a problem until you scroll to the very end of the list, say, by pressing the key, at which point an ugly blank space appears at the bottom. This ugly blank space is ...

Code
Aug 11, 2003
0
0

Answers to exercises

Raymond Chen
Raymond Chen

What is the significance of the cast in the computation of ? It isn't. I got the question wrong. The real question should have been "What is the significance of the cast in the computation of ?" The answer is to ensure that the computation is performed with signed integers throughout...

Code
Aug 7, 2003
0
0

A subtlety in the keyboard code

Raymond Chen
Raymond Chen

I neglected to call it out explicitly in the text for Part 5:  Notice that I use cRepeat to determine how many lines/pages to scroll.  This allows us to scroll the correct amount even if we are falling behind on input processing and are missing some autorepeats...

Code
Aug 7, 2003
0
0

Scrollbars bart 6 – The wheel

Raymond Chen
Raymond Chen

The mouse wheel is tricky because the mouse wheel UI guidelines indicate that you should scroll by a user-specified amount for each "click" of the mouse, where one click is mouse units (called a "detent"). There are two subtle points about the above requirement: First, that the amount of scrolling is a user...

Code
Aug 5, 2003
0
0

Keyboard accessibility for scrollbars

Raymond Chen
Raymond Chen

Note that so far, the scrollbar is accessible only with the mouse. Our next step is to add keyboard access to the scrollbar. Fortunately, this is not all that difficult. We merely map some keystrokes to equivalent scrollbar actions. Note that this doesn't make our sample program fully accessible; this just ...

Code