Sign in to follow this  
Followers 0
Apzo

GuiCtrlCreateListView and GUICtrlSetOnEvent

2 posts in this topic

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.

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0