Listview scroll patch

Dimitrie O. Paun dpaun at rogers.com
Thu Dec 26 20:51:03 CST 2002


On December 26, 2002 04:06 pm, Chris Morgan wrote:
> +/* Replace the scroll value with text */
> +#define SCROLL_CODE_TEXT(nScrollCode) \
> +       (nScrollCode == SB_LINELEFT) ? "SB_LINELEFT" : (nScrollCode ==
> SB_LINERIGHT) \ +               ? "SB_LINERIGHT" : (nScrollCode ==
> SB_INTERNAL) ? "SB_INTERNAL" : \ +               (nScrollCode ==
> SB_PAGELEFT) ? "SB_PAGELEFT" : (nScrollCode == \
> +               SB_PAGERIGHT) ? "SB_PAGERIGHT" : (nScrollCode ==
> SB_THUMBPOSITION) ? \ +               "SB_THUMBPOSITION" : (nScrollCode ==
> SB_THUMBTRACK) ? \ +               "SB_THUMBTRACK" : \
> +               (nScrollCode == SB_ENDSCROLL) ? "SB_ENDSCROLL" \
> +               : "unknown"

Please do not introduce such macros. I don't really think it's necessary
to transform the code to text (it clutters the output), but if you
insist on doing it, just do it through a function:

static inline LPCSTR debugscrollcode(INT nScrollCode)
{
 ...
}

This is the pattern used throughout listview.c. But in general speaking,
if you can do it without macros, then macros are not the answer.

-- 
Dimi.




More information about the wine-devel mailing list