Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tooltips - attribute adjustment
#1
Hi Gintaras,
I know from your last answer that you can dynamically change the text of the tooltips through Tooltip.Update but what about turning tooltips on/off or changing the delay time or the x,y distance from their control, not just at creation but later dynamically depending on other situations.

I see in __Tooltip.Create there are these SendMessage features:

Code:
Copy      Help
int tts=TTS_NOPREFIX
if(flags&1) tts|TTS_ALWAYSTIP
if(flags&2) tts|TTS_BALLOON
htt=CreateWindowExW(WS_EX_TRANSPARENT L"tooltips_class32" 0 tts 0 0 0 0 hwnd 0 _hinst 0)
SendMessage htt TTM_ACTIVATE 1 0
SendMessage htt TTM_SETMAXTIPWIDTH 0 600
if(timeToShow) SendMessage htt TTM_SETDELAYTIME TTDT_AUTOPOP timeToShow*1000


but I am not sure how I would address these dynamically (or at creation).

Thanks again,
S
#2
some examples

Function dialog_tooltip_properties
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3 4 6"
str e3 c4Act e6
c4Act=1
if(!ShowDialog("dialog_tooltip_properties" &dialog_tooltip_properties &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;3 Edit 0x54030080 0x200 6 6 96 14 "" "tooltip"
;4 Button 0x54012003 0x0 6 30 96 12 "Activate all tooltips"
;5 Static 0x54000000 0x0 6 48 30 12 "Time, s"
;6 Edit 0x54030080 0x200 40 46 62 14 ""
;7 Button 0x54032000 0x0 4 66 40 14 "Color..."
;8 Button 0x54032000 0x0 48 66 54 14 "Text color..."
;9 Button 0x54032000 0x0 4 84 98 14 "Set title and icon"
;10 Button 0x54032000 0x0 4 102 98 14 "Change tool info"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030501 "*" "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
__Tooltip& t=DT_GetTooltip(hDlg)
sel wParam
,case EN_CHANGE<<16|6 ;;set time
,_s.getwintext(lParam)
,SendMessage t.htt TTM_SETDELAYTIME TTDT_AUTOPOP val(_s 2)*1000 ;;also can set TTDT_INITIAL etc
,
,case 4 ;;activate/deactivate
,SendMessage t.htt TTM_ACTIVATE but(lParam) 0
,
,case [7,8] ;;color
,if(!ColorDialog(_i 0 hDlg)) ret
,if(GetWindowTheme(t.htt)) SetWindowTheme t.htt L"" L""
,SendMessage t.htt iif(wParam=7 TTM_SETTIPBKCOLOR TTM_SETTIPTEXTCOLOR) _i 0
,
,case 9 ;;title
,SendMessage t.htt TTM_SETTITLEW TTI_ERROR @"Title"
,
,case 10 ;;change some properties for a single control
,TOOLINFOW ti.cbSize=44; ti.hwnd=hDlg; ti.uId=id(3 hDlg); ti.uFlags=TTF_IDISHWND
,if(!SendMessage(t.htt TTM_GETTOOLINFOW 0 &ti)) ret
,ti.lpszText=@"new text"
,ti.uFlags|TTF_CENTERTIP
,SendMessage t.htt TTM_SETTOOLINFOW 0 &ti
,
ret 1

;Most these messages change properties for tooltips of all controls in dialog.
;If need only for some, use own __Tooltip variables, not DT_GetTooltip, and add tooltips in dialog procedure at run time, not in dialog editor.
;TTM_ messages are documented in MSDN Library.
#3
phenomenal!!!! Thanks, S
#4
What is the best way to set all my tooltips in my dialog to display indefinitely until user moves mouse?
(Is it possible? Or must there be fixed delay time?)
#5
Max time is 32. I don't know how to make it longer.
#6
Ok thank you!


Forum Jump:


Users browsing this thread: 1 Guest(s)