digitalmars.D.dwt - Problem with tooltips on Windows
- Bill Baxter (6/6) May 20 2008 snippets\tooltips\Snippet41 does not work properly for me. Instead of
- Bill Baxter (34/41) May 20 2008 I think the problem may be in Shell.d:1690, this function:
- Bill Baxter (4/8) May 20 2008 Doh! Looks like you just fixed this one on May 19!
snippets\tooltips\Snippet41 does not work properly for me. Instead of the intended tooltip text I see random strings of Japanese characters. It could be related to the fact that my default codepage is set to 932 (Japanese). Probably for someone else it would just look like random garbage instead of random Japanese garbage. --bb
May 20 2008
Bill Baxter wrote:snippets\tooltips\Snippet41 does not work properly for me. Instead of the intended tooltip text I see random strings of Japanese characters. It could be related to the fact that my default codepage is set to 932 (Japanese). Probably for someone else it would just look like random garbage instead of random Japanese garbage. --bbI think the problem may be in Shell.d:1690, this function: void setToolTipText (NMTTDISPINFO* lpnmtdi, char [] buffer) { ... if (!hasCursor ()) return; auto hHeap = OS.GetProcessHeap (); if (lpstrTip !is null) OS.HeapFree (hHeap, 0, lpstrTip); int byteCount = buffer.length; lpstrTip = cast(TCHAR*)OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory (lpstrTip, buffer.ptr, byteCount); lpnmtdi.lpszText = lpstrTip; } It's taking a utf8 string and pointing to it with a TCHAR* which is actually a wide char string type. This fixes it for me: void setToolTipText (NMTTDISPINFO* lpnmtdi, char [] buffer) { /* * Ensure that the current position of the mouse * is inside the client area of the shell. This * prevents tool tips from popping up over the * shell trimmings. */ if (!hasCursor ()) return; auto hHeap = OS.GetProcessHeap (); if (lpstrTip !is null) OS.HeapFree (hHeap, 0, lpstrTip); TCHAR[] tbuffer = StrToTCHARs(buffer); int byteCount = tbuffer.length * TCHAR.sizeof; lpstrTip = cast(TCHAR*)OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory (lpstrTip, tbuffer.ptr, byteCount); lpnmtdi.lpszText = lpstrTip; } --bb
May 20 2008
Bill Baxter wrote:Bill Baxter wrote:Doh! Looks like you just fixed this one on May 19! So... nevermind. --bbsnippets\tooltips\Snippet41 does not work properly for me. Instead of the intended tooltip text I see random strings of Japanese characters. ...
May 20 2008