Jump to content

TreeView


Recommended Posts

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

Link to comment
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
Link to comment
Share on other sites

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
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...