Hi KetilO

When scrolling the RadAsm vertical scrollbar a tooltip window appears with the line number. I am trying to do the same with a trackbar in a dialog box i.e. showing the trackbar position in the tooltipwindow. I haven't succeeded. I would appreciate if you could enlighten me what's wrong in my code.
.if uMsg==WM_INITDIALOG

invoke CreateWindowEx,WS_EX_TOPMOST,ADDR ToolTipsClassName,NULL,\
WS_POPUP,CW_USEDEFAULT,\
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,\
hInstance,NULL
mov hwndTool,eax
mov ti.cbSize,sizeof TOOLINFO
mov ti.uFlags,TTF_SUBCLASS or TTF_IDISHWND
push hDlg
pop ti.hWnd
push hTRB
pop ti.uId
mov ti.lpszText,LPSTR_TEXTCALLBACK
invoke SendMessage,hwndTool,TTM_ADDTOOL,NULL,addr ti

.elseif uMsg == WM_NOTIFY
mov ebx, lParam
mov eax, (NMHDR PTR [ebx]).code
.if eax == TTN_NEEDTEXT
invoke SendDlgItemMessage,hDlg,IDC_TRB1,TBM_GETPOS,0,0
invoke SetDlgItemInt,hDlg,IDC_EDT1,eax,FALSE
invoke GetDlgItemText,hDlg,IDC_EDT1,addr buffer,256
lea eax,buffer
mov (TOOLTIPTEXT PTR [ebx]).lpszText,eax
.endif

.elseif uMsg==WM_MOUSEMOVE
mov ebx,lParam
mov eax,(POINT ptr [ebx]).x
add eax,15
mov ecx,(POINT ptr [ebx]).y
invoke SendMessage,hwndTool,TTM_TRACKPOSITION,eax,ecx
invoke SendMessage,hwndTool,TTM_UPDATETIPTEXT or TTN_SHOW,0,addr ti


Regards
Posted on 2003-05-16 04:35:16 by minor28
Try this out it might helpSet up the track bar tips like this
invoke SendDlgItemMessage, hDlg, IDPOSBAR, TBM_GETTOOLTIPS, 0, 0

mov hPOSTIPS,eax

; ti = TOOLINFO structure
invoke GetDlgItem,hDlg,IDPOSBAR
mov ti.uId,eax
mov eax,hDlg
mov ti.hwnd,eax
mov ti.cbSize, SIZEOF TOOLINFO
mov ti.uFlags,TTF_IDISHWND
mov eax,hInstance
mov ti.hinst,eax
mov ti.lpszText,LPSTR_TEXTCALLBACK

invoke SendMessage,hPOSTIPS,TTM_SETTOOLINFO,0,ADDR ti

The code in your TTN_NEEDTEXT notification
mov edx,[edx].NMHDR.idFrom

mov IDFrom,edx
.IF edx == IDPOSBAR
invoke SendDlgItemMessage, hDlg, IDPOSBAR, TBM_GETPOS, 0, 0
mov edx,eax
invoke dw2a,edx,ADDR buffer
mov edx,lParam
lea eax,buffer
mov [edx].TOOLTIPTEXT.lpszText,eax
Posted on 2003-05-16 05:31:47 by donkey
Here is an example without using a tooltip.

KetilO
Posted on 2003-05-16 06:04:42 by KetilO
Hi donkey

I don't have the const. for TBM_GETTOOLTIPS but I assumed the constant to be TTM_GETTOOLINFO. I don't know if it is because of that but your suggestion didn't work. No tooltip at all.

My code works in that way that the tooltip window shows the trackbar position when the mouse pointer is hoovering over the control. What I want is to disply the position continuously when the trackbar is moving like the RadAsm vertical scrollbar.
Posted on 2003-05-16 06:46:45 by minor28
Hi Ketil0

Thanks for the example. Now my code works as I want. I am very grateful.
And thanks donkey, you are always alert in answering my questions. I appreciate that.

regards
Posted on 2003-05-16 07:31:08 by minor28