zeppy Posted February 28, 2008 Share Posted February 28, 2008 How can I detect if my $aListview was double clicked on anywhere on it? Link to comment Share on other sites More sharing options...
FreeFry Posted February 28, 2008 Share Posted February 28, 2008 (edited) I belive a message is sent when it's clicked, you can do a check for that message in your gui..Switch GuiGetMsg() Case $aListView ; ... EndSwitchEdit:Or perhaps the problem is to detect a double click?If that's the case then perhaps you need to use a timer, and a variable to check if the message was sent twice(or more) within some time. Edited February 28, 2008 by FreeFry Link to comment Share on other sites More sharing options...
rasim Posted February 28, 2008 Share Posted February 28, 2008 zeppyFrom help:expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> $hGui = GuiCreate("TestGui", 200, 100) $hListView = _GUICtrlListView_Create($hGui, "Item|Subitem", 5, 5, 195, 50) $LV_Item1 = _GUICtrlListView_AddItem($hListView, "Item1") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $hWndFrom, $iCode, $tNMHDR, $hWndListView $hWndListView = $hListView If Not IsHWnd($hWndListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK MsgBox(0, "", "Double click") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Link to comment Share on other sites More sharing options...
Kip Posted February 28, 2008 Share Posted February 28, 2008 an easier script: expandcollapse popup#include <GUIConstants.au3> #include <Misc.au3> $User32 = DllOpen("User32.dll") AdlibEnable("Check",50) $Gui = GuiCreate("TestGui", 600, 400) $Listview = GUICtrlCreateListView("hi",100,50,400,300) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd DllClose($User32) Func Check() $Mouse = GUIGetCursorInfo($Gui) If IsArray($Mouse) Then if $Mouse[4] Then; $Mouse[4] is the control the mouse is hovering If _IsPressed("01", $User32) Then MsgBox(0,"sdsds","hello") EndIf EndIf EndIf EndFunc MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
rasim Posted February 28, 2008 Share Posted February 28, 2008 an easier script:Your example don`t work correctly. Was need processed double click, not click Link to comment Share on other sites More sharing options...
FreeFry Posted February 28, 2008 Share Posted February 28, 2008 zeppy From help: expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> $hGui = GuiCreate("TestGui", 200, 100) $hListView = _GUICtrlListView_Create($hGui, "Item|Subitem", 5, 5, 195, 50) $LV_Item1 = _GUICtrlListView_AddItem($hListView, "Item1") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $hWndFrom, $iCode, $tNMHDR, $hWndListView $hWndListView = $hListView If Not IsHWnd($hWndListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK MsgBox(0, "", "Double click") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Nice example! Link to comment Share on other sites More sharing options...
zeppy Posted February 28, 2008 Author Share Posted February 28, 2008 I get an error when i run it. says variable used without being declared on line 21. the GUIRegister line Link to comment Share on other sites More sharing options...
GEOSoft Posted February 28, 2008 Share Posted February 28, 2008 I get an error when i run it. says variable used without being declared on line 21. the GUIRegister lineDid you #include the files as shown? George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Achilles Posted February 28, 2008 Share Posted February 28, 2008 (edited) Try updating to the newest version of AutoIt if you don't have it. Edited February 28, 2008 by Achilles My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
FreeFry Posted February 28, 2008 Share Posted February 28, 2008 (edited) What AutoIt version do you have?To late. Edited February 28, 2008 by FreeFry Link to comment Share on other sites More sharing options...
zeppy Posted February 28, 2008 Author Share Posted February 28, 2008 Did you #include the files as shown?Yes i did.and i already have beta. Link to comment Share on other sites More sharing options...
Achilles Posted February 28, 2008 Share Posted February 28, 2008 The problem was the other way around then.. You had beta but the code didn't, this is good: expandcollapse popup#include<StructureConstants.au3> #include<WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <GuiListView.au3> $hGui = GuiCreate("TestGui", 200, 100) $hListView = _GUICtrlListView_Create($hGui, "Item|Subitem", 5, 5, 195, 50) $LV_Item1 = _GUICtrlListView_AddItem($hListView, "Item1") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $hWndFrom, $iCode, $tNMHDR, $hWndListView $hWndListView = $hListView If Not IsHWnd($hWndListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK MsgBox(0, "", "Double click") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
zeppy Posted February 28, 2008 Author Share Posted February 28, 2008 thank you Link to comment Share on other sites More sharing options...
zeppy Posted February 28, 2008 Author Share Posted February 28, 2008 Btw, was does it mean if a listview item is "cut". im reading a function... Link to comment Share on other sites More sharing options...
GaryFrost Posted February 28, 2008 Share Posted February 28, 2008 Btw, was does it mean if a listview item is "cut". im reading a function...The item is marked for a cut-and-paste operation SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. 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