ca143508 Posted July 1, 2008 Share Posted July 1, 2008 HeyGuys, I have a simple listview with 3 columns and some data in it. How can I have a message box popup with text from column 3 for example after I have clicked on an item in that list? Any help would be great. Cheers. Mike Link to comment Share on other sites More sharing options...
Paulie Posted July 1, 2008 Share Posted July 1, 2008 Look up these functions, I'm pretty sure you can then put 2 and 2 together. _GuiCtrlListView_GetSelectedIndices() _GuiCtrlListView_GetItemTextString() Link to comment Share on other sites More sharing options...
rasim Posted July 2, 2008 Share Posted July 2, 2008 ca143508Try this:expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> $hGUI = GUICreate("Test", 300, 200) $hListView = _GUICtrlListView_Create($hGUI, "Items|SubItems|", 10, 10, 280, 180, $LVS_REPORT, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_INFOTIP)) For $i = 1 To 10 _GUICtrlListView_AddItem($hListView, "Item" & $i) _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem" & $i, 1) _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem" & $i, 2) Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CLICK Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) Local $iItem = DllStructGetData($tInfo, "Item") Local $iSubItem = DllStructGetData($tInfo, "SubItem") If $iSubItem = 2 Then Local $iText = _GUICtrlListView_GetItemText($hListView, $iItem, $iSubItem) MsgBox(0, "Message", $iText) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc 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