kenedy Posted October 5, 2004 Share Posted October 5, 2004 Hello. Is it possible to create listbox that would update other control if user clicks on listbox item one time, and do some other action if user uses doubleclick? Here's what I tried: #include "GUIConstants.au3" Dim $Lastselected = "" GUICreate("SomeGUI") $test1 = GUICtrlCreateList ("" , 10, 10,150,350 ) $test2 = GUICtrlCreateList ("" , 170, 10,150,350 ) GuiCtrlSetData($test1, "1|2|3|4|5" ) GuiSetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $test1 $Selected = GUIRead ( $test1 ) If $Selected = $Lastselected Then ; Double click GuiCtrlSetData($test2, $Selected) Else ; Single Click EndIf $Lastselected = $Selected EndSelect Wend It works, but not like doubleclick. There must be ~0,5 second delay between first and second click or second click is ignored. Link to comment Share on other sites More sharing options...
steve8tch Posted January 2, 2006 Share Posted January 2, 2006 Happy new year to you all . I was looking for information on 'double click' support - especially in list boxes - and came upon this post. I don't think there is any built in 'double click' actions in the GUI part of Autoit - does anyone have any other ideas on how to use double click. Thanks Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 2, 2006 Moderators Share Posted January 2, 2006 (edited) Here's a dirty workaround until someone comes up with something better: #include "GUIConstants.au3" GUICreate("SomeGUI") $test1 = GUICtrlCreateList ("" , 10, 10,150,350 ) $test2 = GUICtrlCreateList ("" , 170, 10,150,350 ) GuiCtrlSetData($test1, "1|2|3|4|5" ) GuiSetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case _IsPressed('01') If DoubleClickCheck() = 1 Then GuiCtrlSetData($test2, GUICtrlRead($test1)) EndSelect Wend Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc Func DoubleClickCheck($t_Time_One = 2); $t_Time_One is an optional paramater, you can set the delay longer if you like Do Until _IsPressed('01') = 0 $Timer = TimerInit() While 1 If _IsPressed('01') Then Return 1 If TimerDiff($Timer) / 1000 >= "." & $t_Time_One Then Return 0 WEnd EndFunc Edit: This is a truly crappy work around, the example that was posted before actually works better than this one... I'll play with it a bit more ... Unless I pass out first Edit 2: This has a much better affect on my computer at least. Edited January 2, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
ReFran Posted January 2, 2006 Share Posted January 2, 2006 Here's a dirty workaround until someone comes up with something better: ....Nice small example. If I remember right there has been an discussion in November with examples from Holger and Gary (listview+doubleclick).I think Gary uses the doubleclick coding also in his examples for Editable Listview and Editable Treeview.So if you look further for this, it may help to have a look on this.HTH, Reinhard Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 2, 2006 Moderators Share Posted January 2, 2006 Nice small example. If I remember right there has been an discussion in November with examples from Holger and Gary (listview+doubleclick).I think Gary uses the doubleclick coding also in his examples for Editable Listview and Editable Treeview.So if you look further for this, it may help to have a look on this.HTH, ReinhardI hadn't seen that (Don't spend much time in this forum) but if those 2 did something with it, I'm sure it was much better than what I put out as a temp fix. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
steve8tch Posted January 3, 2006 Share Posted January 3, 2006 I russelled up some code - very similar to Holgers - and it was great - double click was great - but the message loop in the GUI I used for testing only had 1 case statement . When I imported the code into my script - (13 case statements) double click didn't really work. It sort of worked as long as the 2 clicks were more than half second appart - this was not really usable. I have ended up configuring a 'right click' that does the same action as a double click - some of the users find that acceptable. Link to comment Share on other sites More sharing options...
Shinies Posted January 4, 2006 Share Posted January 4, 2006 Argh iv been fuckin around trying to make a function like that for my Tree View but nothing so far Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 4, 2006 Moderators Share Posted January 4, 2006 (edited) I russelled up some code - very similar to Holgers - and it was great - double click was great - but the message loop in the GUI I used for testing only had 1 case statement . When I imported the code into my script - (13 case statements) double click didn't really work. It sort of worked as long as the 2 clicks were more than half second appart - this was not really usable. I have ended up configuring a 'right click' that does the same action as a double click - some of the users find that acceptable.So are you saying this worked for you or it didn't? I mean the parameter there can be set to what you want for the delay between recognizing whether it was a double click or not.Edit:Example: If DoubleClickCheck(1) = 1 Then GuiCtrlSetData($test2, GUICtrlRead($test1)) ; the '1' would set the delay to 1/10th of a secondIf DoubleClickCheck(3) = 1 Then GuiCtrlSetData($test2, GUICtrlRead($test1)) ; the '3' would set the deay to 3/10ths of a secondetc... Edited January 4, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
gcriaco Posted January 25, 2006 Share Posted January 25, 2006 The code doesn't work for left-handed people like me. Any workarounds? Many thanks Peppe Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 25, 2006 Moderators Share Posted January 25, 2006 (edited) Replace '01' with '02' in the _IsPressed() . Edit: Or maybe a more 'Politically Correct Script':expandcollapse popup#include "GUIConstants.au3" Global $PRIMARY, $SECONDARY _MouseButton($PRIMARY, $SECONDARY) GUICreate("SomeGUI") $test1 = GUICtrlCreateList ("" , 10, 10,150,350 ) $test2 = GUICtrlCreateList ("" , 170, 10,150,350 ) GuiCtrlSetData($test1, "1|2|3|4|5" ) GuiSetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case _IsPressed($PRIMARY) If DoubleClickCheck() = 1 Then GuiCtrlSetData($test2, GUICtrlRead($test1)) EndSelect Wend Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc Func DoubleClickCheck($t_Time_One = 2); $t_Time_One is an optional paramater, you can set the delay longer if you like Do Until _IsPressed($PRIMARY) = 0 $Timer = TimerInit() While 1 If _IsPressed($PRIMARY) Then Return 1 If TimerDiff($Timer) / 1000 >= "." & $t_Time_One Then Return 0 WEnd EndFunc Func _MouseButton(ByRef $PRIMARY, ByRef $SECONDARY) Local $k = '' $k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons") If $k = 1 Then $PRIMARY = "02" $SECONDARY = "01" Else $PRIMARY = "01" $SECONDARY = "02" EndIf EndFunc Edited January 25, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
gcriaco Posted January 25, 2006 Share Posted January 25, 2006 Replace '01' with '02' in the _IsPressed() . Edit: Or maybe a more 'Politically Correct Script':expandcollapse popup#include "GUIConstants.au3" Global $PRIMARY, $SECONDARY _MouseButton($PRIMARY, $SECONDARY) GUICreate("SomeGUI") $test1 = GUICtrlCreateList ("" , 10, 10,150,350 ) $test2 = GUICtrlCreateList ("" , 170, 10,150,350 ) GuiCtrlSetData($test1, "1|2|3|4|5" ) GuiSetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case _IsPressed($PRIMARY) If DoubleClickCheck() = 1 Then GuiCtrlSetData($test2, GUICtrlRead($test1)) EndSelect Wend Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc Func DoubleClickCheck($t_Time_One = 2); $t_Time_One is an optional paramater, you can set the delay longer if you like Do Until _IsPressed($PRIMARY) = 0 $Timer = TimerInit() While 1 If _IsPressed($PRIMARY) Then Return 1 If TimerDiff($Timer) / 1000 >= "." & $t_Time_One Then Return 0 WEnd EndFunc Func _MouseButton(ByRef $PRIMARY, ByRef $SECONDARY) Local $k = '' $k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons") If $k = 1 Then $PRIMARY = "02" $SECONDARY = "01" Else $PRIMARY = "01" $SECONDARY = "02" EndIf EndFunc It works fine. Many thanks Peppe Link to comment Share on other sites More sharing options...
Holger Posted January 25, 2006 Share Posted January 25, 2006 Another small possibility (needs beta version minor 3.1.1.102): expandcollapse popup#include "GUIConstants.au3" Global Const $WM_COMMAND = 0x0111 Global Const $LBN_SELCHANGE = 1 Global Const $LBN_DBLCLK = 2 Dim $Lastselected = "" GUICreate("SomeGUI") $test1 = GUICtrlCreateList ("" , 10, 10,150,350 ) $test2 = GUICtrlCreateList ("" , 170, 10,150,350 ) GuiCtrlSetData($test1, "1|2|3|4|5" ) $info = GUICtrlCreateLabel("", 10, 360, 200, 20) GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") GuiSetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $test1 $Selected = GUICtrlRead ( $test1 ) GUICtrlSetData($info, "Currently selected: " & $Selected) EndSelect Wend Exit Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAnd($wParam, 0x0000FFFF) $hCtrl = $lParam If $nID = $test1 Then Switch $nNotifyCode Case $LBN_DBLCLK $Selected = GUICtrlRead ($test1) GuiCtrlSetData($test2, $Selected) Return 0 EndSwitch EndIf EndFunc Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
gcriaco Posted January 25, 2006 Share Posted January 25, 2006 Another small possibility (needs beta version minor 3.1.1.102): expandcollapse popup#include "GUIConstants.au3" Global Const $WM_COMMAND = 0x0111 Global Const $LBN_SELCHANGE = 1 Global Const $LBN_DBLCLK = 2 Dim $Lastselected = "" GUICreate("SomeGUI") $test1 = GUICtrlCreateList ("" , 10, 10,150,350 ) $test2 = GUICtrlCreateList ("" , 170, 10,150,350 ) GuiCtrlSetData($test1, "1|2|3|4|5" ) $info = GUICtrlCreateLabel("", 10, 360, 200, 20) GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") GuiSetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $test1 $Selected = GUICtrlRead ( $test1 ) GUICtrlSetData($info, "Currently selected: " & $Selected) EndSelect Wend Exit Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAnd($wParam, 0x0000FFFF) $hCtrl = $lParam If $nID = $test1 Then Switch $nNotifyCode Case $LBN_DBLCLK $Selected = GUICtrlRead ($test1) GuiCtrlSetData($test2, $Selected) Return 0 EndSwitch EndIf EndFunc Holger Very fine this other example. Many thanks Holger. Peppe Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 25, 2006 Moderators Share Posted January 25, 2006 Holy Cow... I didn't even know that GUIRegisterMsg() existed!! Wow Holger... really a nice job... thanks for putting my poor attempt out of misery lol. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
VoSs2o0o Posted January 27, 2006 Share Posted January 27, 2006 Here is the "official API-Method" of an ListView Event Handler :-) Global Const $WM_NOTIFY = 0x004E ;ListView Events Global Const $NM_FIRST = 0 - 0 Global Const $NM_LAST = 0 - 99 Global Const $NM_OUTOFMEMORY = $NM_FIRST - 1 Global Const $NM_CLICK = $NM_FIRST - 2 Global Const $NM_DBLCLK = $NM_FIRST - 3 Global Const $NM_RETURN = $NM_FIRST - 4 Global Const $NM_RCLICK = $NM_FIRST - 5 Global Const $NM_RDBLCLK = $NM_FIRST - 6 Global Const $NM_SETFOCUS = $NM_FIRST - 7 Global Const $NM_KILLFOCUS = $NM_FIRST - 8 Global Const $NM_CUSTOMDRAW = $NM_FIRST - 12 Global Const $NM_HOVER = $NM_FIRST - 13 Global Const $NM_NCHITTEST = $NM_FIRST - 14 Global Const $NM_KEYDOWN = $NM_FIRST - 15 Global Const $NM_RELEASEDCAPTURE = $NM_FIRST - 16 Global Const $NM_SETCURSOR = $NM_FIRST - 17 Global Const $NM_CHAR = $NM_FIRST - 18 Global Const $NM_TOOLTIPSCREATED = $NM_FIRST - 19 GUIRegisterMsg($WM_NOTIFY, "exEvents") Func exEvents($hWndGUI, $MsgID, $WParam, $LParam) Switch $WParam Case $Listview_1 $tagNMHDR = DllStructCreate ( "int;int;int",$LParam) ;NMHDR (hwndFrom, idFrom, code) $code = DllStructGetData ( $tagNMHDR, 3) Switch $code Case $NM_DBLCLK ConsoleWrite("$NM_DBLCLK" & @crlf) Endswitch Endswitch endfunc AutoItMacroGenerator on my Homepage (Link 2) Link to comment Share on other sites More sharing options...
sdak Posted January 28, 2006 Share Posted January 28, 2006 Strangely, When I use GUIRegisterMsg in GUIOnEventMode all these examples below doesn't works. Link to comment Share on other sites More sharing options...
Holger Posted January 29, 2006 Share Posted January 29, 2006 (edited) Strangely,When I use GUIRegisterMsg in GUIOnEventMode all these examplesbelow doesn't works.Can you give me a short non-working example?So I could take a look what the problem could be.ThanksHolgerEdit: will take a look what the problem is - thanks for info Example not needed:GUIRegisterMsg() and GUIOnEventMode = 1 -> BUGSorry for this stupid mistake - will looking for the problem now that it could be solved in the next beta.Edit2: seems to be a TimingProblem - also in 'GUIGetMsg()'-mode if you use a Sleep()-command.Edit3: I think I found the problem - was an internal false expression to check for the current 'RunMode' - this is if the script is paused or quidded or something else.Also there was a timing problem which is also based on the false thing which I could also solve.So if you have a sleep(5000) for instance then the WM_message-functions will forced to run - before this change (currently) the internal WM_messages were blocked through Sleep() so some messages could not be 'seen'.Sorry for these bugs - have to do more tests in the future...I will do some more tests now...no...at first I will take a sledge and the drive down the hill cause of the cleary weather ... Edited January 29, 2006 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
GaryFrost Posted January 30, 2006 Share Posted January 30, 2006 (edited) Can you give me a short non-working example? So I could take a look what the problem could be. Thanks Holger Edit: will take a look what the problem is - thanks for info Example not needed: GUIRegisterMsg() and GUIOnEventMode = 1 -> BUG Sorry for this stupid mistake - will looking for the problem now that it could be solved in the next beta. Edit2: seems to be a TimingProblem - also in 'GUIGetMsg()'-mode if you use a Sleep()-command. Edit3: I think I found the problem - was an internal false expression to check for the current 'RunMode' - this is if the script is paused or quidded or something else. Also there was a timing problem which is also based on the false thing which I could also solve. So if you have a sleep(5000) for instance then the WM_message-functions will forced to run - before this change (currently) the internal WM_messages were blocked through Sleep() so some messages could not be 'seen'. Sorry for these bugs - have to do more tests in the future... I will do some more tests now...no...at first I will take a sledge and the drive down the hill cause of the cleary weather ... Not sure if your fixes for the above will fix my problem, but something look at anyways, I trimmed this down to just was need to reproduce the problem. Play with the slider control and you'll see what I mean. Edit: More issues? see Code Snippet Gary expandcollapse popup#include <GuiConstants.au3>;Inclusion file for the GUI interface controls #include <GuiListView.au3> Global $Event_On_Control Global $Event_Code 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) Global Const $NM_RETURN = ($NM_FIRST - 4) Global Const $NM_RCLICK = ($NM_FIRST - 5) Global Const $NM_RDBLCLK = ($NM_FIRST - 6) Global Const $NM_SETFOCUS = ($NM_FIRST - 7) Global Const $NM_KILLFOCUS = ($NM_FIRST - 8) Global Const $NM_CUSTOMDRAW = ($NM_FIRST - 12) Global Const $NM_HOVER = ($NM_FIRST - 13) Global Const $NM_NCHITTEST = ($NM_FIRST - 14) Global Const $NM_KEYDOWN = ($NM_FIRST - 15) Global Const $NM_RELEASEDCAPTURE = ($NM_FIRST - 16) Global Const $NM_SETCURSOR = ($NM_FIRST - 17) Global Const $NM_CHAR = ($NM_FIRST - 18) Global Const $NM_TOOLTIPSCREATED = ($NM_FIRST - 19) #endregion End Global variables Opt("WinTitleMatchMode", 2) $main_GUI = GUICreate("GuiRegisterMsg Test", 225, 400, 300, 10, BitOR($WS_THICKFRAME, $WS_SIZEBOX)) $Event_On_Control = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280, BitOR($LVS_SORTASCENDING, $LVS_SINGLESEL)) ;~ $Event_On_Control = $CodeListView _GUICtrlListViewSetColumnWidth ($Event_On_Control, 0, 100) _GUICtrlListViewSetColumnWidth ($Event_On_Control, 1, 100) GUICtrlSendMsg($Event_On_Control, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($Event_On_Control, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) $Trans_slider = GUICtrlCreateSlider(203, 75, 20, 280, $TBS_VERT, $WS_EX_CLIENTEDGE) GUICtrlSetLimit($Trans_slider, 255, 62); change min/max value GUICtrlSetData($Trans_slider, 255) $Transparency = Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) 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 If $Transparency <> Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) Then $Transparency = Int((((Int(GUICtrlRead($Trans_slider)) / 255) * 100) - 100) * - 1) WinSetTrans($main_GUI, "", Int(GUICtrlRead($Trans_slider))) EndIf Switch $Event_Code Case $NM_DBLCLK $Event_Code = 0 ContinueLoop Case $NM_CLICK $Event_Code = 0 ContinueLoop Case Else $Event_Code = 0 EndSwitch EndSwitch WEnd ; ; WM_NOTIFY event handler Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID Local $tagNMHDR, $event Switch $wParam Case $Event_On_Control $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Switch $event Case $NM_CHAR $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_CHAR" & @LF) Case $NM_CLICK $Event_Code = $event If $DebugIt Then ConsoleWrite ("-->$NM_CLICK" & @LF) Case $NM_CUSTOMDRAW $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_CUSTOMDRAW" & @LF) Case $NM_DBLCLK $Event_Code = $event If $DebugIt Then ConsoleWrite ("-->$NM_DBLCLK" & @LF) Case $NM_HOVER $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_HOVER" & @LF) Case $NM_KILLFOCUS $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_KILLFOCUS" & @LF) Case $NM_KEYDOWN $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_KEYDOWN" & @LF) Case $NM_NCHITTEST $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_NCHITTEST" & @LF) Case $NM_OUTOFMEMORY $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_OUTOFMEMORY" & @LF) Case $NM_RCLICK $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RCLICK" & @LF) Case $NM_RDBLCLK $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RDBLCLK" & @LF) Case $NM_RELEASEDCAPTURE $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RELEASEDCAPTURE" & @LF) Case $NM_RETURN $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_RETURN" & @LF) Case $NM_SETCURSOR $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_SETCURSOR" & @LF) Case $NM_SETFOCUS $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_SETFOCUS" & @LF) Case $NM_TOOLTIPSCREATED $Event_Code = $event If $DebugIt Then ConsoleWrite("-->$NM_TOOLTIPSCREATED" & @LF) EndSwitch EndSwitch $tagNMHDR = 0 EndFunc ;==>WM_Notify_Events Edited January 31, 2006 by gafrost 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...
jdefockert Posted February 15, 2006 Share Posted February 15, 2006 Another small possibility (needs beta version minor 3.1.1.102): expandcollapse popup#include "GUIConstants.au3" Global Const $WM_COMMAND = 0x0111 Global Const $LBN_SELCHANGE = 1 Global Const $LBN_DBLCLK = 2 Dim $Lastselected = "" GUICreate("SomeGUI") $test1 = GUICtrlCreateList ("" , 10, 10,150,350 ) $test2 = GUICtrlCreateList ("" , 170, 10,150,350 ) GuiCtrlSetData($test1, "1|2|3|4|5" ) $info = GUICtrlCreateLabel("", 10, 360, 200, 20) GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") GuiSetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $test1 $Selected = GUICtrlRead ( $test1 ) GUICtrlSetData($info, "Currently selected: " & $Selected) EndSelect Wend Exit Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAnd($wParam, 0x0000FFFF) $hCtrl = $lParam If $nID = $test1 Then Switch $nNotifyCode Case $LBN_DBLCLK $Selected = GUICtrlRead ($test1) GuiCtrlSetData($test2, $Selected) Return 0 EndSwitch EndIf EndFunc Holger Hi Holger, This is a great piece of code, it works like a charm. Thank you for posting this! At the moment I need a piece of code that does the following: When the user clicks on/selects a ListViewItem (added during run-time). I want to fill a couple of input fields with the values of the ListViewItem. What I think I need is a function that detects a click on a listviewitem and returns the Index of that item. I have been racking my brain and searching the forum but I could not find a solution. I hope you can help me. Thank you very much in advance! Kind regards, Jasper de Fockert Link to comment Share on other sites More sharing options...
jpam Posted April 26, 2006 Share Posted April 26, 2006 just a question; is the bug in WM_Notify_Events already found ? i have the same problem with WM_Notify_Events and slider controls the slider controls dont function anymore when i disable the line GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") the slider controls functions are normal jpam 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