Jump to content

Recommended Posts

Posted (edited)

Is it possible when i click on an item in some GUICtrlCreateList to do something?

For example this script:

$playlist=GUICtrlCreateList("", 0,$programHeight-149, $programWidth, $programHeight-155, $WS_VSCROLL ,$SS_WHITERECT)
GUICtrlSetLimit(-1,200)
$FileList=_FileListToArray(@DesktopDir, '*.mp3', 1)
For $i = 1 to $FileList[0]
    GuiCtrlSetData($playlist, $i & ". " &$FileList[$i])
Next

When i click on some MP3 to show a msgbox with the mp3's name? I tryed with If $msg = $playlist... but it doesnt work.

Edited by Didonet
Posted

The reason your Listbox click isn't registering is because of the "$SS_WHITERECT" control style your using on the ListBox....

Remove that style and the list box works with a single click with GuiGetMsg().

#include <GUIConstants.au3>
#include <File.au3>

$Gui = GUICreate("Video Control", 320, 220)
$List = GUICtrlCreateList("", 10, 10, 300, 200, $WS_VSCROLL)
$FL2A =_FileListToArray(@WindowsDir & "\Media", '*.wav', 1)
For $i = 1 to $FL2A[0]
    GuiCtrlSetData($List, $i & ". " & $FL2A[$i])
Next
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $List
            MsgBox(64, "Selected Wav", GUICtrlRead($List))
    EndSwitch
WEnd

Cheers

Posted

Hi,

What about double click? .. you didn't mention double click anywhere in your original post..

It's sorta hard to guess what you want when you don't state it clearly and when you provide only incomplete non working code to start with..

So what exactly are you trying to do?

Cheers

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
×
×
  • Create New...