Madza91 Posted December 10, 2008 Share Posted December 10, 2008 Hello... How to set ToolTip for Tab control? I looked at _GUICtrlTab_SetToolTips in Help, don't see a ToolTip when i Hover over a Tab ^^... Why? How to make it to work? Thanks... [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
Madza91 Posted December 10, 2008 Author Share Posted December 10, 2008 I founded answer (but there is with wm_notify):ProgAndy's post [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
Andreik Posted December 10, 2008 Share Posted December 10, 2008 I founded answer (but there is with wm_notify):ProgAndy's postAnd is any problem if use WM_NOTIFY? Link to comment Share on other sites More sharing options...
Madza91 Posted December 10, 2008 Author Share Posted December 10, 2008 No, but I want to know is there any other (maybe better) way, but never mind [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
wraithdu Posted December 10, 2008 Share Posted December 10, 2008 (edited) Really strange, I can't get tabs 5 and 7 to work. They are displaying tabs 1 and 2's tooltips and are not sending the WM_NOTIFY message (Vista and AutoIt v3.2.13.12). Ideas? A new bug in the AutoIt beta, or a problem with Vista? expandcollapse popup#include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GUITab.au3> #include <GUITooltip.au3> $Form2 = GUICreate("Programs", 472, 348, 226, 125) $Tab1 = GUICtrlCreateTab(0, 0, 465, 321) ; Create Tooltiop control Global Const $TABHANDLE = GUICtrlGetHandle($Tab1) $hToolTip = _GUIToolTip_Create($TABHANDLE) _GUICtrlTab_SetToolTips($TABHANDLE,$hToolTip) ; end create GUICtrlSetFont(-1, 8.5, 800, 0, "Arial") GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("Main") _GUIToolTip_AddTool($hToolTip,$TABHANDLE,"tab1", $TabSheet1) GUICtrlSetState(-1,$GUI_SHOW) GUICtrlCreateLabel("This is not a text because it's just a test", 120, 100, 250, 50) $TabSheet2 = GUICtrlCreateTabItem("Black Listed") _GUIToolTip_AddTool($hToolTip,$TABHANDLE,"tab2", $TabSheet2) $TabSheet3 = GUICtrlCreateTabItem("StartUp Items") _GUIToolTip_AddTool($hToolTip,$TABHANDLE,"tab3", $TabSheet3) $TabSheet4 = GUICtrlCreateTabItem("Task Manager") _GUIToolTip_AddTool($hToolTip,$TABHANDLE,"tab4", $TabSheet4) $TabSheet5 = GUICtrlCreateTabItem("Scan USB") _GUIToolTip_AddTool($hToolTip,$TABHANDLE,"tab5", $TabSheet5) $TabSheet6 = GUICtrlCreateTabItem("Pc Info") _GUIToolTip_AddTool($hToolTip,$TABHANDLE,"tab6", $TabSheet6) $TabSheet7 = GUICtrlCreateTabItem("About") _GUIToolTip_AddTool($hToolTip,$TABHANDLE,"tab7", $TabSheet7) GUICtrlCreateTabItem("") GUIRegisterMsg($WM_NOTIFY,"TOOL_WM_NOTIFY") ;End Define Tooltips GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; Prog@ndy Func TOOL_WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) Local $tagNMTTDISPINFOA = "hwnd hWndFrom;int IDFrom;int Code;ptr lpszText;char szText[80];hwnd hinst;uint uFlags;" Local $tagNMTTDISPINFOW = "hwnd hWndFrom;int IDFrom;int Code;ptr lpszText;wchar szText[80];hwnd hinst;uint uFlags;" Local $NMHDR = DllStructCreate($tagNMTTDISPINFOW, $lParam) Local $hWndFrom = DllStructGetData($NMHDR, 1) Local $IdFrom = DllStructGetData($NMHDR, 2) Local $Event = DllStructGetData($NMHDR, 3) Switch $Event Case $TTN_GETDISPINFOW, $TTN_GETDISPINFO If $TTN_GETDISPINFO == $Event Then $NMHDR = DllStructCreate($tagNMTTDISPINFOA, $lParam) ; For ANSI smile.gif If $hwndFrom == $hToolTip Then Local $param = _GUICtrlTab_GetItemParam($TABHANDLE, $IdFrom) ConsoleWrite("tip: " & $IdFrom & ", param: " & $param & @CRLF) ConsoleWrite("text: " & _GUIToolTip_GetText($hwndFrom, $TABHANDLE, $param) & @CRLF) DllStructSetData($NMHDR, "szText", _GUIToolTip_GetText($hwndFrom, $TABHANDLE, $param) & Chr(0)) EndIf Return EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>TOOL_WM_NOTIFY Edited December 10, 2008 by wraithdu Link to comment Share on other sites More sharing options...
ProgAndy Posted December 10, 2008 Share Posted December 10, 2008 This is strange... they really don't send GetTooltip messages, but i have no idea why -> AutoIt or Windows Bug (i have XP MCE SP3) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
wraithdu Posted December 10, 2008 Share Posted December 10, 2008 It's a problem with the tab controls for sure. If you remove the label control, then only tabs 1-4 work, and 5-7 display tips 1-3. Link to comment Share on other sites More sharing options...
ProgAndy Posted December 10, 2008 Share Posted December 10, 2008 well, try to use the udf functions: _GUICtrlTab_Create ... Possibly this will work -> then it's an autot-bug *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
wraithdu Posted December 10, 2008 Share Posted December 10, 2008 I'd say it's an AutoIt bug then, cause this works perfectly. Although, now you have to deal with manually hiding and showing controls on tab switches, but... expandcollapse popup#include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GUITab.au3> #include <GUITooltip.au3> $Form2 = GUICreate("Programs", 472, 348, 226, 125) $TABHANDLE = _GUICtrlTab_Create($Form2, 0, 0, 465, 321, BitOR($TCS_TABS, $TCS_TOOLTIPS)) ; Create Tooltiop control $hToolTip = _GUICtrlTab_GetToolTips($TABHANDLE) ; end create _GUICtrlTab_InsertItem($TABHANDLE, 0, "tab1", -1, 1000) _GUIToolTip_AddTool($hToolTip, $TABHANDLE, "tab1", 1000) _GUICtrlTab_InsertItem($TABHANDLE, 1, "tab2", -1, 1001) _GUIToolTip_AddTool($hToolTip, $TABHANDLE, "tab2", 1001) _GUICtrlTab_InsertItem($TABHANDLE, 2, "tab3", -1, 1002) _GUIToolTip_AddTool($hToolTip, $TABHANDLE, "tab3", 1002) _GUICtrlTab_InsertItem($TABHANDLE, 3, "tab4", -1, 1003) _GUIToolTip_AddTool($hToolTip, $TABHANDLE, "tab4", 1003) _GUICtrlTab_InsertItem($TABHANDLE, 4, "tab5", -1, 1004) _GUIToolTip_AddTool($hToolTip, $TABHANDLE, "tab5", 1004) _GUICtrlTab_InsertItem($TABHANDLE, 5, "tab6", -1, 1005) _GUIToolTip_AddTool($hToolTip, $TABHANDLE, "tab6", 1005) _GUICtrlTab_InsertItem($TABHANDLE, 6, "tab7", -1, 1006) _GUIToolTip_AddTool($hToolTip, $TABHANDLE, "tab7", 1006) ;~ GUICtrlCreateTabItem("") GUIRegisterMsg($WM_NOTIFY,"TOOL_WM_NOTIFY") ;End Define Tooltips GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; Prog@ndy Func TOOL_WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) Local $tagNMTTDISPINFOA = "hwnd hWndFrom;int IDFrom;int Code;ptr lpszText;char szText[80];hwnd hinst;uint uFlags;" Local $tagNMTTDISPINFOW = "hwnd hWndFrom;int IDFrom;int Code;ptr lpszText;wchar szText[80];hwnd hinst;uint uFlags;" Local $NMHDR = DllStructCreate($tagNMTTDISPINFOW, $lParam) Local $hWndFrom = DllStructGetData($NMHDR, 1) Local $IdFrom = DllStructGetData($NMHDR, 2) Local $Event = DllStructGetData($NMHDR, 3) Switch $Event Case $TTN_GETDISPINFOW, $TTN_GETDISPINFO If $TTN_GETDISPINFO == $Event Then $NMHDR = DllStructCreate($tagNMTTDISPINFOA, $lParam) If $hwndFrom == HWnd($hToolTip) Then Local $param = _GUICtrlTab_GetItemParam($TABHANDLE, $IdFrom) Local $text = _GUIToolTip_GetText($hwndFrom, $TABHANDLE, $param) ConsoleWrite("tip: " & $IdFrom & ", param: " & $param & @CRLF) ConsoleWrite("text: " & $text & @CRLF) DllStructSetData($NMHDR, "szText", $text & Chr(0)) EndIf Return EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>TOOL_WM_NOTIFY Link to comment Share on other sites More sharing options...
wraithdu Posted December 11, 2008 Share Posted December 11, 2008 Well I submitted a bug report and got a virtual slap on the wrist. I've come to realize that most mixing of UDF and non-UDF functions is baaaaaaaaaaaaaaad. And Valik sent that point home. He said he came up with a way to do it without the UDF funcs, and I've asked if he can post it, cause I can't figure it out. Link to comment Share on other sites More sharing options...
Josbe Posted December 11, 2008 Share Posted December 11, 2008 Well I submitted a bug report and got a virtual slap on the wrist. I've come to realize that most mixing of UDF and non-UDF functions is baaaaaaaaaaaaaaad. And Valik sent that point home. He said he came up with a way to do it without the UDF funcs, and I've asked if he can post it, cause I can't figure it out.@wraithdu: Me too. I'm curious of how realize that. When I saw this post(yesterday), I was doing tests without success. • AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
wraithdu Posted December 11, 2008 Share Posted December 11, 2008 Here's a quick example for UDF driven tabs w/ tooltips, and controls. Performance isn't bad. I had a whole UDF done up using MDI child windows to hold the controls but tab switching performance was *terrible*, so I scrapped it. expandcollapse popup#include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GUITab.au3> #include <GUITooltip.au3> Global $arr0[1] = [0], $arr1[1] = [0], $arr2[1] = [0] Global $activetab = 0 ; default to first tab active $gui = GUICreate("UDF Tabs w/ Tooltips", 472, 348, 226, 125) $TABHANDLE = _GUICtrlTab_Create($gui, 0, 0, 465, 321, BitOR($TCS_TABS, $TCS_TOOLTIPS)) ; Create Tooltiop control $hToolTip = _GUICtrlTab_GetToolTips($TABHANDLE) ; end create _GUICtrlTab_InsertItem($TABHANDLE, 0, "tab0", -1, 1000) _GUIToolTip_AddTool($hToolTip, $TABHANDLE, "tab0", 1000) _GUICtrlTab_InsertItem($TABHANDLE, 1, "tab1", -1, 1001) _GUIToolTip_AddTool($hToolTip, $TABHANDLE, "tab1", 1001) _GUICtrlTab_InsertItem($TABHANDLE, 2, "tab2", -1, 1002) _GUIToolTip_AddTool($hToolTip, $TABHANDLE, "tab2", 1002) For $i = 1 To 10 _ControlAdd($arr0, GUICtrlCreateLabel("label 0-" & $i, 10, 30 + (25 * ($i - 1)))) GUICtrlSetBkColor(-1, 0xFFFFFF) Next For $i = 1 To 10 _ControlAdd($arr0, GUICtrlCreateButton("button 0-" & $i, 70, 30 + (25 * ($i - 1)), 70, 20)) Next For $i = 1 To 10 _ControlAdd($arr1, GUICtrlCreateLabel("label 1-" & $i, 30, 30 + (25 * ($i - 1)))) GUICtrlSetBkColor(-1, 0xFFFFFF) Next For $i = 1 To 10 _ControlAdd($arr1, GUICtrlCreateButton("button 1-" & $i, 90, 30 + (25 * ($i - 1)), 70, 20)) Next For $i = 1 To 10 _ControlAdd($arr2, GUICtrlCreateLabel("label 2-" & $i, 50, 30 + (25 * ($i - 1)))) GUICtrlSetBkColor(-1, 0xFFFFFF) Next For $i = 1 To 10 _ControlAdd($arr2, GUICtrlCreateButton("button 2-" & $i, 110, 30 + (25 * ($i - 1)), 70, 20)) Next ;~ ;; tab0 is default ;~ _ControlState(0, $GUI_SHOW) ;; tab1 is default _GUICtrlTab_SetCurSel($TABHANDLE, 1) _ControlState(1, $GUI_SHOW) $activetab = 1 ;~ GUICtrlCreateTabItem("") GUIRegisterMsg($WM_NOTIFY,"TOOL_WM_NOTIFY") ;End Define Tooltips GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _ControlAdd(ByRef $array, $cID) $array[0] += 1 ReDim $array[$array[0] + 1] $array[$array[0]] = $cID GUICtrlSetState(-1, $GUI_HIDE) ; hide all controls Return $cID EndFunc Func _TabClick($iTab) If $iTab == $activetab Then Return _ControlState($activetab, $GUI_HIDE) ; hide _ControlState($iTab, $GUI_SHOW) ; show $activetab = $iTab EndFunc Func _ControlState($iArr, $iState) Local $array = Eval("arr" & $iArr) For $i = 1 To $array[0] GUICtrlSetState($array[$i], $iState) Next EndFunc ; Prog@ndy Func TOOL_WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) Local $tagNMTTDISPINFOA = "hwnd hWndFrom;int IDFrom;int Code;ptr lpszText;char szText[80];hwnd hinst;uint uFlags;" Local $tagNMTTDISPINFOW = "hwnd hWndFrom;int IDFrom;int Code;ptr lpszText;wchar szText[80];hwnd hinst;uint uFlags;" Local $NMHDR = DllStructCreate($tagNMTTDISPINFOW, $lParam) Local $hWndFrom = DllStructGetData($NMHDR, 1) Local $IdFrom = DllStructGetData($NMHDR, 2) Local $Event = DllStructGetData($NMHDR, 3) Switch $Event Case $TTN_GETDISPINFOW, $TTN_GETDISPINFO If $TTN_GETDISPINFO == $Event Then $NMHDR = DllStructCreate($tagNMTTDISPINFOA, $lParam) If $hwndFrom == HWnd($hToolTip) Then Local $param = _GUICtrlTab_GetItemParam($TABHANDLE, $IdFrom) Local $text = _GUIToolTip_GetText($hwndFrom, $TABHANDLE, $param) ;~ ConsoleWrite("tip: " & $IdFrom & ", param: " & $param & @CRLF) ;~ ConsoleWrite("text: " & $text & @CRLF) DllStructSetData($NMHDR, "szText", $text & Chr(0)) EndIf Case $NM_CLICK Local $oldmco = Opt("MouseCoordMode", 2) Local $mpos = MouseGetPos() Opt("MouseCoordMode", $oldmco) Local $idx = _GUICtrlTab_HitTest($hWndFrom, $mpos[0], $mpos[1]) ; get index of clicked tab If $idx[0] <> -1 Then _TabClick($idx[0]) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>TOOL_WM_NOTIFY Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now