Jump to content

GuiCtrlCreateListView and GUICtrlSetOnEvent


Apzo
 Share

Recommended Posts

Hello all

I'd like to fill an input box with the content of a previously generated ListViewItem.

I tried :

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

$MAING = GUICreate("", 250, 222)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

$user = GuiCtrlCreateInput("", 0, 0, 100, 20)

$online = GuiCtrlCreateListView ("Label", 0, 22, 200, 130 )
GuiCtrlCreateListViewItem("toto", $online)
GUICtrlSetOnEvent(-1, "DumpData")

GUISetState(@SW_SHOW)

While 1
    Sleep(100000)
Wend

Func CLOSEClicked()
  Exit
EndFunc

Func DumpData ()
    MsbBox(0, "", "Hey, I'm alive !!"); test purpose
    $Data = GUICtrlRead(@GUI_CtrlId)
    GUICtrlSetData($user, $Data)
EndFunc

Problem : when I select "toto" in my list, the input box stays empty.

Of course this script is very simple, actually I have a listview filled with listviewitems and I don't know how many.

I need GUIOnEventMode set to 1.

Any idea ?

Thanks in advance,

Apzo.

Link to comment
Share on other sites

With GuiCtrlCreateListViewItem("toto", $online) you have to guictrlread the Listview

GUICtrlRead($online) = $toto

Then that poses another isue, you put that in a loop and it will loop forever unless somehow you unselect it.

I really not entirely sure how to set that up, maybe this will spark something :lmao:

Triton
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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