|
Post by Brandon Parker on Apr 10, 2018 21:04:57 GMT -5
Hmmmm.....
Seems that should have worked to at least set the TTDT_INITIAL ....
That being said.... you listed 5000 as the value. That's 5 seconds (5000 ms) that you are telling the ToolTip to wait prior to showing the ToolTip. Did you wait within the control's rectangle that long to allow the ToolTip to show? I set the code up and it worked perfectly at 5 seconds; changed it to 1500 and it worked at 1.5 seconds.
You can use these two functions to figure out what time in ms you would be passing; in this case it's simply what you pass, but you might find the functions useful in the future.
Print LOWORD(1500)
Function LOWORD(dw) LOWORD = (dw And 65535) End Function
Function HIWORD(dw) HIWORD = int((dw / 65536)) End Function
{:0)
Brandon Parker
|
|
xtal
Junior Member
Posts: 61
|
Post by xtal on Apr 11, 2018 19:16:15 GMT -5
The hover delay does not change from default, heres my sub code now . I running Windows 10 ....
Sub AddTooltip hWnd, Text$, hTT, multiLine ti.uId.struct = hWnd ti.lpszText.struct = Text$ '------------------------------------------------------------------------------------------------------------------ TTM.SETDELAYTIME = 1027 ' 0x403 = 1027 ==> SetTimeDelay ? TTDT.AUTOPOP = 2 ' 2 =====> Display Time ? CallDLL #user32, "SendMessageA", _ ' hTT As ulong, _ ' Handle to ToolTip TTM.SETDELAYTIME As long, _ ' Message to Send TTDT.AUTOPOP As long, _ ' lParam 31500 As ulong, _ ' wParam Time in ms < 32000 >32000=5 seconds AddTooltip As long ' Return value not used '------------------------------------------------------------------------------------------------------------------- TTM.SETDELAYTIME = 1027 ' 0x403 = 1027 ==> SetTimeDelay ? TTDT.INITIAL = 3 ' 2 =====> Hover Time b4 popup? 3 ==> Hover time CallDLL #user32, "SendMessageA", _ ' hTT As ulong, _ ' Handle to ToolTip TTM.SETDELAYTIME As long, _ ' Message to Send TTDT.INITIAL As long, _ ' lParam 5000 As ulong, _ ' wParam 1.5 sec (ms) AddTooltip As long ' Return value not used '----------------------------------------------------------------------------------------------------------------- CallDLL #user32, "SendMessageA", _ hTT As long, _ 1028 As long, _ ' TTM_ADDTOOLA (0x404 = 1028) name = hTT 0 As long, _ ti as ptr, _ ret As long '----------------------------------------------------------------------------------------------------------------- TTM.SETMAXTIPWIDTH =_WM_USER + 24 '1048 'multiline CallDLL #user32, "SendMessageA", hTT As ulong, _ TTM.SETMAXTIPWIDTH As long, _ _NULL As long, _ ti As struct, _ AddTooltip As long
End Sub
|
|
|
Post by Chris Iverson on Apr 11, 2018 20:46:31 GMT -5
I'm running Windows 10 as well, I've copied your sub code in, and it delays for five seconds before triggering the tooltip, as expected.
Here's the exact, full code I'm using, that's working for me.
'© Dennis McKinney 2002 'You may use this code freely in your own programs. 'This code may not be redistributed, published in whole or in part, 'posted to any group or bulletin board, nor placed on any web site 'without the authors permission.
NoMainWin
'TOOLINFO structure Struct ti, _ cbSize As long, _ uFlags As long, _ hwnd As long, _ uId As long, _ left As long, _ top As long, _ right As long, _ bottom As long, _ hinst As long, _ lpszText As ptr
ti.cbSize.struct = Len(ti.struct) ti.uFlags.struct = 17
WindowWidth = 300 WindowHeight = 200 UpperLeftX = Int((DisplayWidth - WindowWidth) / 2) UpperLeftY = Int((DisplayHeight - WindowHeight) / 2)
button #1.btn, "Red", [x], UL, 5, 5, 40, 25 button #1.btn2, "Blue", [x], UL, 50, 5, 40, 25 button #1.btn3, "Green", [x], UL, 95, 5, 40, 25 open "Easy Tooltips" for window as #1 print #1, "trapclose [quit]" hParent = hwnd(#1)
hTT = CreateTooltip(hParent) call AddTooltip hwnd(#1.btn),"Red",hTT call AddTooltip hwnd(#1.btn2),"Blue",hTT call AddTooltip hwnd(#1.btn3),"Green",hTT
wait
[quit] close #1 end
[x] wait
Function CreateTooltip(hParent) style=64 '0=standard box tooltip 64 = balloon tooltip CallDLL #user32, "CreateWindowExA",0 As long,"tooltips_class32" As ptr,_ 0 As long, style As long,_CW_USEDEFAULT As long,_CW_USEDEFAULT As long,_ _CW_USEDEFAULT As long,_CW_USEDEFAULT As long,hParent As Ulong,_ 0 As long,0 As long,0 As long,CreateTooltip As Ulong End Function
Sub AddTooltip hWnd, Text$, hTT ti.uId.struct = hWnd ti.lpszText.struct = Text$ '------------------------------------------------------------------------------------------------------------------ TTM.SETDELAYTIME = 1027 ' 0x403 = 1027 ==> SetTimeDelay ? TTDT.AUTOPOP = 2 ' 2 =====> Display Time ? CallDLL #user32, "SendMessageA", _ ' hTT As ulong, _ ' Handle to ToolTip TTM.SETDELAYTIME As long, _ ' Message to Send TTDT.AUTOPOP As long, _ ' lParam 31500 As ulong, _ ' wParam Time in ms < 32000 >32000=5 seconds AddTooltip As long ' Return value not used '------------------------------------------------------------------------------------------------------------------- TTM.SETDELAYTIME = 1027 ' 0x403 = 1027 ==> SetTimeDelay ? TTDT.INITIAL = 3 ' 2 =====> Hover Time b4 popup? 3 ==> Hover time CallDLL #user32, "SendMessageA", _ ' hTT As ulong, _ ' Handle to ToolTip TTM.SETDELAYTIME As long, _ ' Message to Send TTDT.INITIAL As long, _ ' lParam 5000 As ulong, _ ' wParam 1.5 sec (ms) AddTooltip As long ' Return value not used '----------------------------------------------------------------------------------------------------------------- CallDLL #user32, "SendMessageA", _ hTT As long, _ 1028 As long, _ ' TTM_ADDTOOLA (0x404 = 1028) name = hTT 0 As long, _ ti as ptr, _ ret As long '----------------------------------------------------------------------------------------------------------------- TTM.SETMAXTIPWIDTH =_WM_USER + 24 '1048 'multiline CallDLL #user32, "SendMessageA", hTT As ulong, _ TTM.SETMAXTIPWIDTH As long, _ _NULL As long, _ ti As struct, _ AddTooltip As long
End Sub
|
|
xtal
Junior Member
Posts: 61
|
Post by xtal on Apr 12, 2018 6:05:50 GMT -5
Yep this works in mine too... thx Now I just need to find out why it's not working in My Gcode sender program....
|
|
xtal
Junior Member
Posts: 61
|
Post by xtal on Apr 12, 2018 8:04:17 GMT -5
I found this Function, no Clue who created it.. I added the Hover increase and Display increase ,,, works great.... Large ToolTips [3k my case] will flicker if it overflows outside the screen display...... I repositioned some code now both procedures work...
FUNCTION MAKETIP(handle$, text$, style$, width) hMain = hwnd(#handle$) Struct TOOLINFO, _ cbSize As long, _ uFlags As long, _ hwnd As long, _ uId As long, _ rectLeft As long, _ rectTop As long, _ rectRight As long, _ rectBottom As long, _ hinst As long, _ lpszText As ptr callDLL #comctl32,"InitCommonControlsEx", _ ' Ensure DLL commom control DLL is loaded result as void TOOLINFO.cbSize.struct = Len(TOOLINFO.struct) TOOLINFO.uFlags.struct = flags Or 17 'TTF_IDISHWND Or TTF_SUBCLASS TOOLINFO.hwnd.struct = hMain if upper$(left$(style$,1))="B" then style = 64 else style=0 callDLL #user32,"CreateWindowExA",_ ' Create ToolTip name = hTip ?? 0 As long, _ "tooltips_class32" As ptr, _ 0 As long,_ style As long, _ _CW_USEDEFAULT As long, _ _CW_USEDEFAULT As long, _ _CW_USEDEFAULT As long, _ _CW_USEDEFAULT As long, _ hMain As long, _ 0 As long, _ 0 as long, _ 0 As long, _ hTip As Long TOOLINFO.uId.struct = hMain TOOLINFO.lpszText.struct = text$ '------------------------------------------------------------------------------------------------------------------ ' Change ToolTip Display time '------------------------------------------------------------------------------------------------------------------ TTM.SETDELAYTIME = 1027 ' 1027 ==> SetTimeDelay ? TTDT.AUTOPOP = 2 ' 2 =====> Display Time ? CallDLL #user32, "SendMessageA", _ ' hTip As ulong, _ ' Handle to ToolTip TTM.SETDELAYTIME As long, _ ' Message to Send 1027 TTDT.AUTOPOP As long, _ ' lParam 2 31500 As ulong, _ ' wParam 31.5 sec(ms) if > 32000 = 5 sec AddTooltip As long ' Return value not used '------------------------------------------------------------------------------------------------------------------- TTM.SETDELAYTIME = 1027 ' 1027 ==> SetTimeDelay ? TTDT.INITIAL = 3 ' 3 =====> Hover Time ? CallDLL #user32, "SendMessageA", _ ' hTip As ulong, _ ' Handle to ToolTip TTM.SETDELAYTIME As long, _ ' Message to Send 1027 = SetDelayTime TTDT.INITIAL As long, _ ' lParam 2 = load hover time 4000 As ulong, _ ' wParam 4 sec(ms) AddTooltip As long ' Return value not used '------------------------------------------------------------------------------------------------------------------- callDLL #user32, "SendMessageA",_ hTip As long, _ 1028 As long, _ 0 As long, _ TOOLINFO as ptr, _ result as long if width>0 then TTM.SETMAXTIPWIDTH = _WM_USER + 24 CallDLL #user32, "SendMessageA", _ hTip As ULong, _ TTM.SETMAXTIPWIDTH As ULong, _ _NULL As Long, _ width As Long, _ ret As Long end if MAKETIP = hTip END FUNCTION '=================================================================================================================== 'It is used like: 'Code: 'ntip = MAKETIP("#main.button","Click to self-destruct in 30 seconds","B",160)
|
|