Jump to content

Recommended Posts

Posted

I want to make a list, and let the user select an item from the list by double-clicking it. I've read the help file, and it seems like I need to use $LBS_NOTIFY when I declare my list, but I don't know how to detect the double-click, so that I can make the list window close once the user has selected the item. So far, I can detect a single-clicked value, but I want to make it more user-friendly by only executing the next code section if there's a double-click.

Here's my code:

#include <guiconstants.au3>

$null=""
dim $choices[4]=[1,2,3,4]

guicreate("My List")
$options=guictrlcreatelist($null,10,20,200,200,$lbs_notify)
for $c=0 to ubound($choices)-1
    $text=$choices[$c]
    guictrlsetdata($options,$text)
Next
guisetstate()
while 1
    $msg=guigetmsg()
    $selection=guictrlread($options)
    if ($msg=$gui_event_close) or ($msg=$options) Then
        ExitLoop
    EndIf
WEnd
msgbox(0,"",$selection)
Posted

Hi,

I don't sure about List, but maybe ListView?

#include <GuiConstants.au3>

Global Const $WM_NOTIFY = 0x004E
Global $DoubleClicked   = False

GUICreate("Double Click Demo", 400, 300)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")


$ListViewID = GuiCtrlCreateListView("List Column", 10, 20, 380, 250)

For $i = 1 To 10
    GuiCtrlCreateListViewItem("Item " & $i, $ListViewID)
Next

GUISetState()

While GUIGetMsg() <> -3
    Sleep(10)
    If $DoubleClicked Then
        DoubleClickFunc()
        $DoubleClicked = False
    EndIf
WEnd

Func DoubleClickFunc()
    MsgBox(64, "OK", "Double Clicked: " & GUICtrlRead(GUICtrlRead($ListViewID)))
EndFunc

Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam)
    Local $tagNMHDR, $event, $hwndFrom, $code
    $tagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return 0
    $code = DllStructGetData($tagNMHDR, 3)
    If $wParam = $ListViewID And $code = -3 Then $DoubleClicked = True
    Return $GUI_RUNDEFMSG
EndFunc

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

Global Const $WM_COMMAND                        = 0x0111

    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")oÝ÷ Ù«­¢+ÙÕ¹]5}
=559 ÀÌØí¡]¹°ÀÌØí¥5ͰÀÌØí¥ÝAÉ´°ÀÌØí¥±AÉ´¤(%1½°ÀÌØí¡]¹É½´°ÀÌØí¥%ɽ´°ÀÌØí¥
½°ÀÌØí¡]¹1¥ÍÑ    ½à(%%9½Ð%Í!]¹ ÀÌØí¡1¥ÍÑ   ½à¤Q¡¸ÀÌØí¡]¹1¥ÍÑ ½àôU%
ÑɱÑ!¹± ÀÌØí¡1¥ÍÑ ½à¤($ÀÌØí¡]¹É½´ôÀÌØí¥±AÉ´($ÀÌØí¥%ɽ´ô ¥Ñ9 ÀÌØí¥ÝAÉ´°Áá¤ì1½Ü]½É($ÀÌØí¥
½ô    ¥ÑM¡¥Ð ÀÌØí¥ÝAÉ´°Äؤì!¤]½É((%MÝ¥Ñ ÀÌØí¡]¹É½´($%
ÍÀÌØí¡1¥ÍÑ ½à°ÀÌØí¡]¹1¥ÍÑ  ½à($$%MÝ¥Ñ ÀÌØí¥
½($$$%
ÍÀÌØí1 9}  1
1,ìM¹ÐÝ¡¸Ñ¡ÕÍȽձµ±¥­ÌÍÑÉ¥¹¥¸±¥Íнà($$$$%}ÕAÉ¥¹Ð ÅÕ½ÐìÀÌØí1   9}  1
1,ÅÕ½ÐìµÀì1µÀìÅÕ½Ðì´´ØÈì¡]¹É½´èÅÕ½ÐìµÀìQµÀìÀÌØí¡]¹É½´µÀì1µÀì|($$$$$$$ÅÕ½Ðì´´ØÈí%ɽ´èÅÕ½ÐìµÀìQµÀìÀÌØí¥%ɽ´µÀì1µÀì|($$$$$$$ÅÕ½Ðì´´ØÈí
½èÅÕ½ÐìµÀìQµÀìÀÌØí¥
½¤($$$$$ì¹¼ÉÑÕɸٱÕ($$$%
ÍÀÌØí1 9}IIMA
ìM¹ÐÝ¡¸±¥Íн๹½Ð±±½Ñ¹½Õ µµ½ÉäѼµÐÍÁ¥¥ÉÅÕÍÐ($$$$%}ÕAÉ¥¹Ð ÅÕ½ÐìÀÌØí1  9}IIMA
ÅÕ½ÐìµÀì1µÀìÅÕ½Ðì´´ØÈì¡]¹É½´èÅÕ½ÐìµÀìQµÀìÀÌØí¡]¹É½´µÀì1µÀì|($$$$$$$ÅÕ½Ðì´´ØÈí%ɽ´èÅÕ½ÐìµÀìQµÀìÀÌØí¥%ɽ´µÀì1µÀì|($$$$$$$ÅÕ½Ðì´´ØÈí
½èÅÕ½ÐìµÀìQµÀìÀÌØí¥
½¤($$$$$ì¹¼ÉÑÕɸٱÕ($$$%
ÍÀÌØí1 9}-%11=
ULìM¹ÐÝ¡¸±¥Íн౽ÍÌÑ¡­å½É½ÕÌ($$$$%}ÕAÉ¥¹Ð ÅÕ½ÐìÀÌØí1 9}-%11=
ULÅÕ½ÐìµÀì1µÀìÅÕ½Ðì´´ØÈì¡]¹É½´èÅÕ½ÐìµÀìQµÀìÀÌØí¡]¹É½´µÀì1µÀì|($$$$$$$ÅÕ½Ðì´´ØÈí%ɽ´èÅÕ½ÐìµÀìQµÀìÀÌØí¥%ɽ´µÀì1µÀì|($$$$$$$ÅÕ½Ðì´´ØÈí
½èÅÕ½ÐìµÀìQµÀìÀÌØí¥
½¤($$$$$ì¹¼ÉÑÕɸٱÕ($$$%
ÍÀÌØí1 9}M1
9
0ìM¹ÐÝ¡¸Ñ¡ÕÍȹ±Ìѡͱѥ½¸¥¸±¥Íнà($$$$%}ÕAÉ¥¹Ð ÅÕ½ÐìÀÌØí1    9}M1
9
0ÅÕ½ÐìµÀì1µÀìÅÕ½Ðì´´ØÈì¡]¹É½´èÅÕ½ÐìµÀìQµÀìÀÌØí¡]¹É½´µÀì1µÀì|($$$$$$$ÅÕ½Ðì´´ØÈí%ɽ´èÅÕ½ÐìµÀìQµÀìÀÌØí¥%ɽ´µÀì1µÀì|($$$$$$$ÅÕ½Ðì´´ØÈí
½èÅÕ½ÐìµÀìQµÀìÀÌØí¥
½¤($$$$$ì¹¼ÉÑÕɸٱÕ($$$%
ÍÀÌØí1 9}M1
!9ìM¹ÐÝ¡¸Ñ¡Í±Ñ¥½¸¥¸±¥Íнà¡Ì¡¹($$$$%}ÕAÉ¥¹Ð ÅÕ½ÐìÀÌØí1   9}M1
!9ÅÕ½ÐìµÀì1µÀìÅÕ½Ðì´´ØÈì¡]¹É½´èÅÕ½ÐìµÀìQµÀìÀÌØí¡]¹É½´µÀì1µÀì|($$$$$$$ÅÕ½Ðì´´ØÈí%ɽ´èÅÕ½ÐìµÀìQµÀìÀÌØí¥%ɽ´µÀì1µÀì|($$$$$$$ÅÕ½Ðì´´ØÈí
½èÅÕ½ÐìµÀìQµÀìÀÌØí¥
½¤($$$$$ì¹¼ÉÑÕɸٱÕ($$$%
ÍÀÌØí1 9}MQ=
ULìM¹ÐÝ¡¸±¥ÍнàÉ¥ÙÌÑ¡­å½É½ÕÌ($$$$%}ÕAÉ¥¹Ð ÅÕ½ÐìÀÌØí1 9}MQ=
ULÅÕ½ÐìµÀì1µÀìÅÕ½Ðì´´ØÈì¡]¹É½´èÅÕ½ÐìµÀìQµÀìÀÌØí¡]¹É½´µÀì1µÀì|($$$$$$$ÅÕ½Ðì´´ØÈí%ɽ´èÅÕ½ÐìµÀìQµÀìÀÌØí¥%ɽ´µÀì1µÀì|($$$$$$$ÅÕ½Ðì´´ØÈí
½èÅÕ½ÐìµÀìQµÀìÀÌØí¥
½¤($$$$$ì¹¼ÉÑÕɸٱÕ($$%¹MÝ¥Ñ (%¹MÝ¥Ñ ($ìAɽѡձÐÕѽ¥ÐÌ¥¹Ñɹ°µÍͽµµ¹Ì¸($ìe½Ô±Í¼¸½µÁ±Ñ±ÐÑ¡±¥¹½Õи($ìÌÌìÌÌìÌÌì  Õн¹±äÌäíIÑÕɸÌäì¡Ý¥Ñ¡½Õйäٱդݥ±°¹½ÐÁɽ($ìѡձÐÕѽ¥Ð̵µÍÍ¥¸Ñ¡ÕÑÕÉÌÌìÌÌìÌÌì(%IÑÕɸÀÌØíU%}IU95M)¹Õ¹ìôôÐí]5}
=559()Õ¹}ÕAÉ¥¹Ð ÀÌØíÍ}ÑáФ($ÀÌØíÍ}ÑáÐôMÑÉ¥¹IÁ± ÀÌØíÍ}Ñáа1°1µÀìÅÕ½Ðì´´ØÈìÅÕ½Ðì¤(%
½¹Í½±]É¥Ñ ÅÕ½ÐìÌÌìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôÅÕ½ÐìµÀì1µÀì|($$$ÅÕ½Ðì¬ôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôÅÕ½ÐìµÀì1µÀì|($$$ÅÕ½Ðì´´ØÈìÅÕ½ÐìµÀìÀÌØíÍ}ÑáеÀì1µÀì|($$$ÅÕ½Ðì¬ôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôÅÕ½ÐìµÀì1¤)¹Õ¹ìôôÐí}ÕAÉ¥¹

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

  • 4 weeks later...
Posted

  Piano_Man said:

Where can you find the constants, such as $LBN_DBLCLK?

In the beta you should be able to find the constants depending which control etc your looking for.

For example $LBN_DBLCLK should be found in ListBoxConstants.au3

I'm guessing that is what you mean, if you mean where do the values come from I used a tool call APIViewer 2004

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Posted (edited)

  GaryFrost said:

In the beta you should be able to find the constants depending which control etc your looking for.

For example $LBN_DBLCLK should be found in ListBoxConstants.au3

I'm guessing that is what you mean, if you mean where do the values come from I used a tool call APIViewer 2004

Ok, thanks, I found them... however they were under #include <A3LListbox.au3> that PaulIA made and not in my beta. I'm downloading the newest beta now but it's going to take a few minutes.

EDIT: Beta fixed it. Now it the other constants I was using too :)

Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...