Jump to content
Sign in to follow this  
JamesDover

GuiCtrlCreateTreeView

Recommended Posts

JamesDover

It seems the first or last are wrong on the ini output. Any Ideas?

This outputs different depending on which is checked. ini output 257 instead of 1 and 260 instead of 4

Thanks

$TreeView1 = GUICtrlCreateTreeView(296, 136, 113, 135, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES, $WS_GROUP, $WS_TABSTOP))
GUICtrlSetFont(-1, 9, 800, 0, "Arial")
$TreeView1_1 = GUICtrlCreateTreeViewItem("1", $TreeView1)
$TreeView1_2 = GUICtrlCreateTreeViewItem("2", $TreeView1)
$TreeView1_3 = GUICtrlCreateTreeViewItem("3", $TreeView1)
$TreeView1_4 = GUICtrlCreateTreeViewItem("4", $TreeView1)
$TreeView1_5 = GUICtrlCreateTreeViewItem("5", $TreeView1)
$TreeView1_6 = GUICtrlCreateTreeViewItem("6", $TreeView1)
$TreeView1_7 = GUICtrlCreateTreeViewItem("7", $TreeView1)
$TreeView1_8 = GUICtrlCreateTreeViewItem("8", $TreeView1)
$TreeView1_9 = GUICtrlCreateTreeViewItem("9", $TreeView1)
$TreeView1_10 = GUICtrlCreateTreeViewItem("10", $TreeView1)

If $Debug = "1"

GUICtrlSetState($TreeView1_1, $GUI_CheckED)

Else

GUICtrlSetState($TreeView1_1, $GUI_UNCheckED)

EndIf

IniWrite("test.ini", "Initialize", "Check1", GUICtrlRead($TreeView1_1))

Share this post


Link to post
Share on other sites
star2

can u post a small script example showing your problem


[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites
star2

from the help file

So use i.e. BitAnd(GUICtrlRead($Item),$GUI_CHECKED) to test if the item is checked.

this example will return only 1 for checked and 0 for un checked

#include <GuiConstants.au3>
; ================= main GUI ====================
$Main = GUICreate ("test", 200,150 )
$TreeView1 = GUICtrlCreateTreeView(10, 10, 180, 100, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES, $WS_GROUP, $WS_TABSTOP))
GUICtrlSetFont(-1, 9, 800, 0, "Arial")
$TreeView1_1 = GUICtrlCreateTreeViewItem("1 - this is the first choice", $TreeView1)
$TreeView1_2 = GUICtrlCreateTreeViewItem("2 - this is the second choic", $TreeView1)
$TreeView1_3 = GUICtrlCreateTreeViewItem("3 - this is the third choic", $TreeView1)
$TreeView1_4 = GUICtrlCreateTreeViewItem("4 - this is the fourth choic", $TreeView1)
$TreeView1_5 = GUICtrlCreateTreeViewItem("5 - this is the fifth choic", $TreeView1)

$b = GUICtrlCreateButton ("Button", 10 , 120, 180,25)
GUISetState ()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $b Then
        MsgBox (-1, "", BitAnd(GUICtrlRead($TreeView1_1),$GUI_CHECKED))
        MsgBox (-1, "", BitAnd(GUICtrlRead($TreeView1_2),$GUI_CHECKED))
        MsgBox (-1, "", BitAnd(GUICtrlRead($TreeView1_3),$GUI_CHECKED))
        MsgBox (-1, "", BitAnd(GUICtrlRead($TreeView1_4),$GUI_CHECKED))
        MsgBox (-1, "", BitAnd(GUICtrlRead($TreeView1_5),$GUI_CHECKED))
    EndIf
WEnd
Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites
JamesDover

Cheers! That is exatly what I needed :D

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  

×