ReFran Posted June 5, 2007 Share Posted June 5, 2007 Hello, I tested a script from gary to get a reliable LDown. I want to start edit if LDown pressed for a defined Time. I think the edit functions (start, end ...) I can take from other examples. But how can I set a timer for LDown for ... seconds. Following the slowly changed code from Gary. Best regards, Reinhard expandcollapse popup; Events - ListView #include <GuiConstants.au3>;Inclusion file for the GUI interface controls #include <GuiListView.au3> Global $ListView Global Const $WM_NOTIFY = 0x004E Global Const $DebugIt = 1 ;ListView Events Global Const $NM_FIRST = 0 Global Const $NM_LAST = (-99) ;Global Const $NM_OUTOFMEMORY = ($NM_FIRST - 1) 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() $label = GUICtrlCreateLabel("Info",10,360,150,20) ;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_Ldown() ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite (_DebugHeader ("$NM_LDown")) ;---------------------------------------------------------------------------------------------- EndFunc ;==>ListView_Click Func ListView_Click() ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite (_DebugHeader ("$NM_CLICK")) ;---------------------------------------------------------------------------------------------- EndFunc ;==>ListView_Click Func ListView_DoubleClick() ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite (_DebugHeader ("$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 = -100 $CursInf = GUIGetCursorInfo() if $cursinf[2] = 1 then GUICtrlSetData($label,"LDown - is pressed") ListView_Ldown() endif Case $event = $NM_CLICK GUICtrlSetData($label,"$NMClick") ListView_Click () Case $event = $NM_DBLCLK GUICtrlSetData($label,"$NMDoubleClick") ListView_DoubleClick () EndSelect EndSelect $tagNMHDR = 0 $event = 0 $lParam = 0 EndFunc ;==>WM_Notify_Events Func _DebugHeader($s_text) Return _ "!===========================================================" & @LF & _ "+===========================================================" & @LF & _ "-->" & $s_text & @LF & _ "+===========================================================" & @LF EndFunc ;==>_DebugHeader Link to comment Share on other sites More sharing options...
ReFran Posted June 5, 2007 Author Share Posted June 5, 2007 Got it. Put a $timerStart = @sec under LDown and $timerEnd=@sec under NM_Click in the Notify events and then compare it. Seems to me a reliable solution for startion editing, or? br, Reinhard Link to comment Share on other sites More sharing options...
ReFran Posted June 27, 2007 Author Share Posted June 27, 2007 Mmmh, using the events I want to do something meaningful on a click-event (displaying a Msgbox or whatever), what NOT should be done if the item is double-clicked. The problem is: a click-event is always in front of a double-click event. Is there a standard solution for this? Best regards, Reinhard Franke 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