rasim Posted February 7, 2008 Share Posted February 7, 2008 Hi! How can show tooltip for ListView elements, i tryed, but unsuccessfully. expandcollapse popup#include <GuiListView.au3> #include <GuiImageList.au3> #include <GuiToolTip.au3> #include <GuiConstantsEx.au3> #include <Array.au3> $Gui = GUICreate("Test", 320, 220) $hListView = _GUICtrlListView_Create($GUI, "Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_EDITLABELS, $LVS_REPORT), $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT, $LVS_EX_INFOTIP)) _GUICtrlListView_SetColumnWidth($hListView, 0, 98) _GUICtrlListView_SetColumnWidth($hListView, 1, 98) _GUICtrlListView_SetColumnWidth($hListView, 2, 98) $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon ($hImage, "shell32.dll", 3) _GUIImageList_AddIcon ($hImage, "shell32.dll", 11) _GUIImageList_AddIcon ($hImage, "shell32.dll", 22) _GUIImageList_AddIcon ($hImage, "shell32.dll", 33) _GUICtrlListView_SetImageList($hListView, $hImage, 1) _GUICtrlListView_AddItem($hListView, "Item1",0) _GUICtrlListView_AddItem($hListView, "Item2",2) _GUICtrlListView_AddItem($hListView, "Item3",1) _GUICtrlListView_AddItem($hListView, "Item4",3) _GUICtrlListView_AddSubItem ($hListView, 0,'44', 1, 2) _GUICtrlListView_AddSubItem ($hListView, 1,'22', 1, 1) _GUICtrlListView_AddSubItem ($hListView, 2,'11', 1, 0) _GUICtrlListView_AddSubItem ($hListView, 3,'33', 1, 3) _GUICtrlListView_AddSubItem ($hListView, 0,'New', 2, 1) _GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2, 3) _GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2, 2) _GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2, 0) $hToolTip = _GUIToolTip_Create($hListView, $TTS_ALWAYSTIP) _GUICtrlListView_SetToolTips($hListView, $hToolTip) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iCode, $tNMHDR, $hWndListView, $tInfo, $iColumnIndex $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_GETINFOTIP $tInfo = DllStructCreate($tagNMLVGETINFOTIP, $ilParam) Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text")) ConsoleWrite(DllStructGetData($tBuffer, "Text")) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Link to comment Share on other sites More sharing options...
rasim Posted February 7, 2008 Author Share Posted February 7, 2008 Looks like: Anyone know? Link to comment Share on other sites More sharing options...
rasim Posted February 8, 2008 Author Share Posted February 8, 2008 Damn! All what need - just use $LVS_EX_INFOTIP style expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <Array.au3> $Gui = GUICreate("Test", 320, 220) $hListView = _GUICtrlListView_Create($GUI, "Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_EDITLABELS, $LVS_REPORT), $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT, $LVS_EX_INFOTIP)) _GUICtrlListView_SetColumnWidth($hListView, 0, 98) _GUICtrlListView_SetColumnWidth($hListView, 1, 98) _GUICtrlListView_SetColumnWidth($hListView, 2, 98) $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon ($hImage, "shell32.dll", 3) _GUIImageList_AddIcon ($hImage, "shell32.dll", 11) _GUIImageList_AddIcon ($hImage, "shell32.dll", 22) _GUIImageList_AddIcon ($hImage, "shell32.dll", 33) _GUICtrlListView_SetImageList($hListView, $hImage, 1) _GUICtrlListView_AddItem($hListView, "Some long name item1",0) _GUICtrlListView_AddItem($hListView, "Some long name item2",2) _GUICtrlListView_AddItem($hListView, "Some long name item3",1) _GUICtrlListView_AddItem($hListView, "Some long name item4",3) _GUICtrlListView_AddSubItem ($hListView, 0,'44', 1, 2) _GUICtrlListView_AddSubItem ($hListView, 1,'22', 1, 1) _GUICtrlListView_AddSubItem ($hListView, 2,'11', 1, 0) _GUICtrlListView_AddSubItem ($hListView, 3,'33', 1, 3) _GUICtrlListView_AddSubItem ($hListView, 0,'New', 2, 1) _GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2, 3) _GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2, 2) _GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2, 0) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd 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