Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Simulate DoubleClick in ListBox


  • Please log in to reply
26 replies to this topic

#1 kenedy

kenedy

    Seeker

  • Active Members
  • 15 posts

Posted 05 October 2004 - 05:03 PM

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:
Plain Text         
#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.







#2 steve8tch

steve8tch

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 291 posts

Posted 02 January 2006 - 11:23 AM

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

#3 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,830 posts

Posted 02 January 2006 - 12:29 PM

Here's a dirty workaround until someone comes up with something better:
Plain Text         
#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 :P

Edit 2:
This has a much better affect on my computer at least.

Edited by SmOke_N, 02 January 2006 - 01:03 PM.

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.


#4 ReFran

ReFran

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 554 posts

Posted 02 January 2006 - 05:22 PM

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

#5 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,830 posts

Posted 02 January 2006 - 06:25 PM

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


I 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.


#6 steve8tch

steve8tch

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 291 posts

Posted 03 January 2006 - 11:32 PM

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. :P I have ended up configuring a 'right click' that does the same action as a double click - some of the users find that acceptable.

#7 Shinies

Shinies

    Adventurer

  • Active Members
  • PipPip
  • 100 posts

Posted 04 January 2006 - 01:51 AM

Argh iv been fuckin around trying to make a function like that for my Tree View but nothing so far :P

#8 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,830 posts

Posted 04 January 2006 - 02:28 AM

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. :P 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 second
If DoubleClickCheck(3) = 1 Then GuiCtrlSetData($test2, GUICtrlRead($test1)) ; the '3' would set the deay to 3/10ths of a second

etc...

Edited by SmOke_N, 04 January 2006 - 02:30 AM.

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.


#9 gcriaco

gcriaco

    Polymath

  • Active Members
  • PipPipPipPip
  • 206 posts

Posted 25 January 2006 - 11:04 AM

The code doesn't work for left-handed people like me.

Any workarounds?


Many thanks


Peppe

#10 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,830 posts

Posted 25 January 2006 - 02:30 PM

Replace '01' with '02' in the _IsPressed() :lmao: .

Edit:
Or maybe a more 'Politically Correct Script':
Plain Text         
#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 by SmOke_N, 25 January 2006 - 02:32 PM.

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.


#11 gcriaco

gcriaco

    Polymath

  • Active Members
  • PipPipPipPip
  • 206 posts

Posted 25 January 2006 - 02:46 PM

Replace '01' with '02' in the _IsPressed() :lmao: .

Edit:
Or maybe a more 'Politically Correct Script':

Plain Text         
#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

#12 Holger

Holger

    AutoIt Spammer

  • Developers
  • 1,384 posts

Posted 25 January 2006 - 03:15 PM

Another small possibility (needs beta version minor 3.1.1.102):

Plain Text         
#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

#13 gcriaco

gcriaco

    Polymath

  • Active Members
  • PipPipPipPip
  • 206 posts

Posted 25 January 2006 - 03:39 PM

Another small possibility (needs beta version minor 3.1.1.102):

Plain Text         
#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

#14 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,830 posts

Posted 25 January 2006 - 04:09 PM

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.


#15 VoSs2o0o

VoSs2o0o

    Seeker

  • Active Members
  • 33 posts

Posted 27 January 2006 - 11:52 PM

Here is the "official API-Method" of an ListView Event Handler :-)

Plain Text         
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)

#16 sdak

sdak

    Seeker

  • New Members
  • 4 posts

Posted 28 January 2006 - 09:37 PM

Strangely,

When I use GUIRegisterMsg in GUIOnEventMode all these examples
below doesn't works.

#17 Holger

Holger

    AutoIt Spammer

  • Developers
  • 1,384 posts

Posted 29 January 2006 - 06:06 AM

Strangely,

When I use GUIRegisterMsg in GUIOnEventMode all these examples
below doesn't works.

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 :lmao:
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 ;)...

Edited by Holger, 29 January 2006 - 09:00 AM.


#18 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 30 January 2006 - 06:06 PM

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 :lmao:
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

Plain Text         
#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 by gafrost, 31 January 2006 - 04:06 AM.

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.


#19 jdefockert

jdefockert

    Seeker

  • Active Members
  • 13 posts

Posted 15 February 2006 - 04:32 PM

Another small possibility (needs beta version minor 3.1.1.102):

Plain Text         
#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

#20 jpam

jpam

    Mass Spammer!

  • Active Members
  • PipPipPipPipPipPip
  • 439 posts

Posted 26 April 2006 - 09:44 PM

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 :think:
when i disable the line GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
the slider controls functions are normal

jpam




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users