Der_Andi Posted September 15, 2006 Posted September 15, 2006 Hi, in my GUI i placed a ListView. For testing, i created a dummy-item in this LV. Normally, the action takes place, when you do a single click on such items. With TimerInit (and something more) you can make the item react on a doublelclick. The item ist linked to a function called "_edit". I'm convinced, that the function should work, but it doesn't. Can you see something? So long... Andi Func _edit() If $timer = 0 Then $timer = timerinit() Else If TimerDiff($timer) < 400 Then msgbox(0, "", "test") EndIf $timer = 0 EndIf EndFunc
GaryFrost Posted September 15, 2006 Posted September 15, 2006 You should be able to adapt this for what your doing, this has a click/double click event expandcollapse popup; Events - ListView #include <GuiConstants.au3>;Inclusion file for the GUI interface controls #include <GuiListView.au3> #region Global variables Global $ListView Global Const $WM_NOTIFY = 0x004E Global Const $DebugIt = 1 ;ListView Events Global Const $NM_FIRST = 0 Global Const $NM_CLICK = ($NM_FIRST - 2) Global Const $NM_DBLCLK = ($NM_FIRST - 3) #endregion End Global variables Opt("WinTitleMatchMode", 2) $main_GUI = GUICreate("GuiRegisterMsg Test", 225, 400, 300, 10, BitOR($WS_THICKFRAME, $WS_SIZEBOX)) $ListView = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280, BitOR($LVS_SORTASCENDING, $LVS_SINGLESEL)) _GUICtrlListViewSetColumnWidth ($ListView, 0, 100) _GUICtrlListViewSetColumnWidth ($ListView, 1, 100) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlCreateListViewItem("Name 1|Category 1", $ListView) GUICtrlCreateListViewItem("Name 2|Category 2", $ListView) GUISetState() ;Register WM_NOTIFY events GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 $msg = GUIGetMsg() Switch $msg ;----------------------------------------------------------------------------------------- ;This case statement exits and updates code if needed Case $GUI_EVENT_CLOSE Exit ;----------------------------------------------------------------------------------------- ;put all the misc. stuff here Case Else ;;; EndSwitch WEnd Func ListView_Click() ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("$NM_CLICK") ;---------------------------------------------------------------------------------------------- EndFunc ;==>ListView_Click Func ListView_DoubleClick() ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint ("$NM_DBLCLK") ;---------------------------------------------------------------------------------------------- MsgBox(0,"Double Clicked", _GUICtrlListViewGetItemText ($ListView, _GUICtrlListViewGetSelectedIndices($ListView))) EndFunc ;==>ListView_DoubleClick ; ; WM_NOTIFY event handler Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) ;NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $ListView Select Case $event = $NM_CLICK ListView_Click () Case $event = $NM_DBLCLK ListView_DoubleClick () EndSelect EndSelect $tagNMHDR = 0 $event = 0 $lParam = 0 EndFunc ;==>WM_Notify_Events Func _DebugPrint($s_text) ConsoleWrite( _ "!===========================================================" & @LF & _ "+===========================================================" & @LF & _ "-->" & $s_text & @LF & _ "+===========================================================" & @LF) EndFunc ;==>_DebugPrint SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Der_Andi Posted September 15, 2006 Author Posted September 15, 2006 (edited) well, thanks. i grabbed some parts of your code and that work's, too.But how would my solution correctly look like? Edited September 29, 2006 by Der_Andi
xcal Posted September 29, 2006 Posted September 29, 2006 But how would my solution correctly look like?How could anyone say when you haven't posted your code? How To Ask Questions The Smart Way
Der_Andi Posted September 29, 2006 Author Posted September 29, 2006 I have posted my code.Look at my initial post on top of this thread.See?
GaryFrost Posted September 29, 2006 Posted September 29, 2006 Not sure why you want to use a deprecated method but try:Search +GUI_EVENT_PRIMARYDOWN +gafrost in graphics support SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
paullab Posted September 29, 2006 Posted September 29, 2006 The source in http://www.autoitscript.com/forum/index.ph...c=33549&hl=in the Scripta and scraps section has neat double click handling (I got it from somewhere else on the forum so credit to the original poster) Wallpaper Rotatorwith overlay, Loop through a folder of wallpaper & another of overlay, then create a combined image and set it as the wallpaperE-Mail passthru, Send any file, even executables via e-mail as plain text. The recipient can then later re-construct them.Slideshow widget, A slideshow widget similar to the Vista onePredictive typing using the Numpad, Predictive typing using the numpad of a keyboar similar to that on a mobile phone (the key is the .t16 file).PSTools Front End, For Remote Admin. Just makes life a lot easier (Demonstrates executing external programs and passing parameters, tabbed form Handling STDIN/STDERR)FTP Helper application Up and Download files from an FTP server demonstrates this and Tooltray TipsShow a Map of your Post-codes/Zip Codes, Uses the Clipboard, Hotkeys, the system tray (incl. menus)Disc/CD/DVD Catalogue, Ideal for all those Covermount Discs (Demonstrates Array handling, executing DOS programs, handling STDIN/STDOUT recursive directory reads, file searching.)YAST , Yet another Stopwatch/Timer (Uses a hotkey, Copies to clipboard, handles multiple events and stays on top)Keyboard Status Indicator , Indicates status of NumLock, Caps Lock and Scroll Lock Keys, demonstrates API calling & System tray Icon Toggling
GaryFrost Posted September 29, 2006 Posted September 29, 2006 The source in http://www.autoitscript.com/forum/index.ph...c=33549&hl=in the Scripta and scraps section has neat double click handling (I got it from somewhere else on the forum so credit to the original poster)Look in post #2 here SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
JohnBailey Posted February 21, 2007 Posted February 21, 2007 GaFrost, what is the _DebugPrint for? A decision is a powerful thing
Shevilie Posted February 21, 2007 Posted February 21, 2007 Debugging Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
JohnBailey Posted February 21, 2007 Posted February 21, 2007 Haha. yeah ok how do you use that?! I'm always looking for debug methods Thanks shevilie!! For direction this is great! A decision is a powerful thing
Shevilie Posted February 21, 2007 Posted February 21, 2007 To check a variable ... If $DebugIt Then _DebugPrint("$NM_CLICK") So whenever $DebugIt is set to true.. the program sends the vars to the console Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
JohnBailey Posted February 21, 2007 Posted February 21, 2007 (edited) THAT's FREAKING AWESOME!! My apologies for overlooking any of the obvious. I need to drink some more tea and recharge or something. My brain is toast. Thank you both for this. Seriously, Shevilie tons of good bits of knowledge and insight. I'm learning a ton even in my low mental state, which says a lot. I'm excited to start using and experimenting with this debug method! Edited February 21, 2007 by JohnBailey A decision is a powerful thing
Shevilie Posted February 21, 2007 Posted February 21, 2007 I need to drink some more tea and rechargeTry Cult or Redbull Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
JohnBailey Posted February 21, 2007 Posted February 21, 2007 lol great now I'm laughing out loud at my computer while at work A decision is a powerful thing
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