News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Listview tooltip problem

Started by minor28, May 17, 2010, 11:05:51 AM

Previous topic - Next topic

minor28

I have been struggling to get a tooltips control to work with a listview control but not succeeded to do it as I want. The code below is working with commenting the line (2) and no matter how the other lines (1) or (3) are commented.

However if I want to retrieve the text with LPSTR_TEXTCALLBACK the listview will not resieve any TTN_NEEDTEXT notification messages.

Can someone see if I am missing something?


Main dialog window with a listview control

.if eax==WM_INITDIALOG
invoke CreateWindowEx,WS_EX_TOPMOST,offset szToolTipClass,0,WS_POPUP or TTS_NOPREFIX or TTS_BALLOON,
0,0,0,0,hWin,0,hInstance,0
mov hTT,eax

invoke GetDlgItem,hWin,1002
mov hLSV,eax

;(1) invoke SendMessage,hLSV,LVM_SETTOOLTIPS,0,hTT

invoke SendMessage,hLSV,LVM_SETEXTENDEDLISTVIEWSTYLE,
LVS_EX_FULLROWSELECT or LVS_EX_GRIDLINES,
LVS_EX_FULLROWSELECT or LVS_EX_GRIDLINES

invoke SetWindowLong,hLSV,GWL_WNDPROC,offset LSVWinProc
mov OldLSVWinProc,eax

mov ti.cbSize,sizeof ti
mov ti.uFlags,TTF_SUBCLASS
push hLSV
pop ti.hWnd
mov ti.uId,0
invoke GetClientRect,hLSV,addr rect
push rect.left
pop ti.rect.left
push rect.top
pop ti.rect.top
push rect.right
pop ti.rect.right
push rect.bottom
pop ti.rect.bottom
mov ti.lpszText,offset szTooltip
;(2) mov ti.lpszText,LPSTR_TEXTCALLBACK
invoke SendMessage,hTT,TTM_ADDTOOL,0,addr ti



LSVWinProc

.if eax==WM_NOTIFY
mov edi,lParam
.if [edi].TOOLTIPTEXT.hdr.code==TTN_NEEDTEXT
mov [edi].TOOLTIPTEXT.hInst,0
mov [edi].TOOLTIPTEXT.lpszText,offset szTooltip
;(3) invoke CallWindowProc,OldLSVWinProc,hWin,uMsg,wParam,lParam
; ret

.else
invoke CallWindowProc,OldLSVWinProc,hWin,uMsg,wParam,lParam
ret
.endif
.else
invoke CallWindowProc,OldLSVWinProc,hWin,uMsg,wParam,lParam
ret

.endif
xor eax,eax
ret



Thanks

Gunner

using dialog boxes you don't use callwindowproc, you return true if you process the message and false to let the dialog manager process the message..  i'm not at a computer to look at my code, but i think that is right   
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

qWord

maybe I misunderstood what are you tyring to do,
but you you can set the LVS_EX_INFOTIP style for the listview, so that the parent then receives the LVN_GETINFOTIPA/W notification message.This gives you the ability to specific a string to be shown as a tooltip.

qword
FPU in a trice: SmplMath
It's that simple!

minor28

As I understand the listview default tooltip LVS_EX_INFOTIP only works on the first column. I want it to work over the whole client rectangle.

qWord

I've played a bit with it and found, that tool tip controll allways send the TTN_NEEDTEXTW/TTN_GETDISPINFOW message - the ANSI version is never send (all controlls are created with ANSI functions).
In the attachmend you will find an full working example (on vista32  :P)
regards qWord
FPU in a trice: SmplMath
It's that simple!

minor28