Sign in to follow this  
Followers 0
Synapse

TreeView

8 posts in this topic

Hi is there a simple way to get the tree items (or subitems) text or id when i click it...

Thank you

Share this post


Link to post
Share on other sites



Hi,

General question.. then the general answer is yes.

There's a few contributing factors as to which way to do it eg: are you using on event mode or not, using internal or external listview items etc...

Post a working sample of your code if your wanting further info on what is the easiest way to get the id/text of the listview item clicked.

Cheers

Share this post


Link to post
Share on other sites

Hi is there a simple way to get the tree items (or subitems) text or id when i click it...

Thank you

Try this:

#include <GuiConstants.au3>

Opt("GuiOnEventMode", 1)

$hGUI = GUICreate("Test GUI", 300, 200)

GUICreate("My GUI with treeview", 350, 215)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

$treeview       = GUICtrlCreateTreeView(6, 6, 100, 150, BitOr($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)

$DummyStart = GUICtrlCreateDummy()
$generalitem    = GUICtrlCreateTreeViewitem("General", $treeview)
$aboutitem      = GUICtrlCreateTreeViewitem("About", $generalitem)
$compitem       = GUICtrlCreateTreeViewitem("Computer", $generalitem)
$useritem       = GUICtrlCreateTreeViewitem("User", $generalitem)


$displayitem    = GUICtrlCreateTreeViewitem("Display", $treeview)
$resitem        = GUICtrlCreateTreeViewitem("Resolution", $displayitem)
$otheritem      = GUICtrlCreateTreeViewitem("Other", $displayitem)
$DummyEnd = GUICtrlCreateDummy()

GUISetState()

For $i = $DummyStart To $DummyEnd
    GUICtrlSetOnEvent($i, "_GetText")
Next

While 1
    Sleep(100)
WEnd

Func _Exit()
    Exit
EndFunc

Func _GetText()
    ConsoleWrite(GUICtrlRead(@GUI_CtrlId, 1) & @LF)
EndFunc
:D

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thank you all...the example Rasim gave me it`s exactly what i needed...thx again...

@smashly no need to be sarcastic...btw..i was talking about a treeView not a listview...

Edited by Synapse

Share this post


Link to post
Share on other sites

Is there a way avoiding onevent mode?

Share this post


Link to post
Share on other sites

Yes. Use Message loop mode. More details/examples in helpfile.

thx...I asked here in the Help Thread...cuz I allready tryed using the help and didn`t made it...never came out as i wanted....

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