Commit 55ff2549 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

comctl32: Invalid format returned by NF_QUERY defaults to ANSI in treeview.

parent fcb9c5fa
......@@ -956,6 +956,10 @@ static void test_get_set_unicodeformat(void)
hTree = create_treeview_control(0);
fill_tree(hTree);
/* Check that an invalid format returned by NF_QUERY defaults to ANSI */
bPreviousSetting = (BOOL)SendMessage( hTree, TVM_GETUNICODEFORMAT, 0, 0 );
ok(bPreviousSetting == 0, "Format should be ANSI.\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* Set to Unicode */
......@@ -1007,10 +1011,17 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam,
}
switch(message) {
case WM_NOTIFYFORMAT:
{
/* Make NF_QUERY return an invalid format to show that it defaults to ANSI */
if (lParam == NF_QUERY) return 0;
break;
}
case WM_NOTIFY:
{
NMHDR *pHdr = (NMHDR *)lParam;
ok(pHdr->code != NM_TOOLTIPSCREATED, "Treeview should not send NM_TOOLTIPSCREATED\n");
if (pHdr->idFrom == 100)
{
......
......@@ -848,7 +848,9 @@ static INT TREEVIEW_NotifyFormat (TREEVIEW_INFO *infoPtr, HWND hwndFrom, UINT nC
format = SendMessageW(hwndFrom, WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwnd, NF_QUERY);
TRACE("format=%d\n", format);
if (format != NFR_ANSI && format != NFR_UNICODE) return 0;
/* Invalid format returned by NF_QUERY defaults to ANSI*/
if (format != NFR_ANSI && format != NFR_UNICODE)
format = NFR_ANSI;
infoPtr->bNtfUnicode = (format == NFR_UNICODE);
......@@ -5067,10 +5069,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr->hwndNotify = lpcs->hwndParent;
infoPtr->hwndToolTip = 0;
infoPtr->bNtfUnicode = IsWindowUnicode (hwnd);
/* Determine what type of notify should be issued */
/* sets infoPtr->bNtfUnicode */
/* Determine what type of notify should be issued (sets infoPtr->bNtfUnicode) */
TREEVIEW_NotifyFormat(infoPtr, infoPtr->hwndNotify, NF_REQUERY);
if (!(infoPtr->dwStyle & TVS_NOTOOLTIPS))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment