Sign in to follow this  
Followers 0
Shyke

Tree Dread

18 posts in this topic

On this particular project that I'm working on, it seems that I will have to use a tree control to get done what I need.

I need a tree to be able tyo have up to nine sub entries added, then up to nine sub entries for each sub entry and continuing until it's five sub entries thick. The user must be able to delete these sub entries and their "folders" of stuff that they contain. When a entry is clicked on it should display a input box, button and edit box on the other side of the GUI.

I am not asking for code here, just to be pushed in the right direction.

Share this post


Link to post
Share on other sites



If its about the controls appearing try putting them in a child GUI and hiding the GUI then showing it. o_0


[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites

To clear this up...

I'm trying to find a way to organize something that could go like this:

Main

-----Sub

----------Sub

--------------Sub

----------Sub

--------------Sub

--------------Sub

--------------Sub

------------------Sub

------------------Sub

------------------Sub

--------------Sub

----------Sub

-----Sub

-----Sub

----------Sub

-----Sub

-----Sub

-----Sub

-----Sub

-----Sub

-----Sub

And when you click on the Main or Sub, it shows those three controls on the other side.

Share this post


Link to post
Share on other sites

Well to create all the Sub's, I'll recommend arrays and loops :whistle: Would then also make the onclicking a lot easier :)


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

Anyone else have any ideas?

Share this post


Link to post
Share on other sites

Anyone else have any ideas?

Sure, as soon as you show what you've actually tried :whistle: .

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>

GuiCreate("Menu Mod Generator", 545, 310,-1, -1)

GuiCtrlCreateGroup("Tree Stuff", 10, 10, 140, 250)
;tree creation shit here

GuiCtrlCreateGroup("Code For Selection", 160, 10, 370, 250)
GuiCtrlCreateLabel("Question:", 170, 30, 50, 20)
$qIn = GuiCtrlCreateInput("", 220, 30, 300, 20)
$cIn = GuiCtrlCreateEdit("", 170, 60, 350, 150)
$done = GuiCtrlCreateButton("Done", 290, 220, 100, 30)
$compile = GuiCtrlCreateButton("Compile", 205, 270, 120, 30)

GuiSetState()
Do
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
Until 0

The GUI crap I have done.

I'm not going to get into the actual coding of it and the like until I have a GUI that works as it's supposed to.

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>

GuiCreate("Menu Mod Generator", 545, 310,-1, -1)

GuiCtrlCreateGroup("Tree Stuff", 10, 10, 140, 250)
;tree creation shit here

GuiCtrlCreateGroup("Code For Selection", 160, 10, 370, 250)
GuiCtrlCreateLabel("Question:", 170, 30, 50, 20)
$qIn = GuiCtrlCreateInput("", 220, 30, 300, 20)
$cIn = GuiCtrlCreateEdit("", 170, 60, 350, 150)
$done = GuiCtrlCreateButton("Done", 290, 220, 100, 30)
$compile = GuiCtrlCreateButton("Compile", 205, 270, 120, 30)

GuiSetState()
Do
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
Until 0

The GUI crap I have done.

I'm not going to get into the actual coding of it and the like until I have a GUI that works as it's supposed to.

You're kidding right? I meant ... show what you have "tried", there' s no effort there at all.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Dim $q[10], $sq[10][10]

GuiCreate("Menu Mod Generator", 545, 310, -1, -1)

GuiCtrlCreateGroup("Tree Stuff", 10, 10, 140, 250)
$tree = GuiCtrlCreateTreeView(20, 30, 120, 220)
;how do I set the bg color of the tree to the same color as the program?
$main = GUICtrlCreateTreeViewItem("Main", $tree)
For $i = 1 To 9
    $q[$i] = GuiCtrlCreateTreeViewItem("Q" & $i, $main)
    $sq[$i][1] = GuiCtrlCreateTreeViewItem("SQ" & $i, $q[1])
    $sq[$i][2] = GuiCtrlCreateTreeViewItem("SQ" & $i, $q[2])
    $sq[$i][3] = GuiCtrlCreateTreeViewItem("SQ" & $i, $q[3])
    $sq[$i][4] = GuiCtrlCreateTreeViewItem("SQ" & $i, $q[4])
    $sq[$i][5] = GuiCtrlCreateTreeViewItem("SQ" & $i, $q[5])
    $sq[$i][6] = GuiCtrlCreateTreeViewItem("SQ" & $i, $q[6])
    $sq[$i][7] = GuiCtrlCreateTreeViewItem("SQ" & $i, $q[7])
    $sq[$i][8] = GuiCtrlCreateTreeViewItem("SQ" & $i, $q[8])
    $sq[$i][9] = GuiCtrlCreateTreeViewItem("SQ" & $i, $q[9])
Next


GuiCtrlCreateGroup("Code For Selection", 160, 10, 370, 250)
GuiCtrlCreateLabel("Question:", 170, 30, 50, 20)
$qIn = GuiCtrlCreateInput("", 220, 30, 300, 20)
$cIn = GuiCtrlCreateEdit("", 170, 60, 350, 150)
$done = GuiCtrlCreateButton("Done", 290, 220, 100, 30)
$compile = GuiCtrlCreateButton("Compile", 205, 270, 120, 30)

GuiSetState()
Do
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    If $msg = $done Then _Done()
    If $msg = $compile Then _Compile()
Until 0

Func _Done()
EndFunc

Func _Compile()
EndFunc

A couple questions based on that:

1. Why does as each proceeding SQ View Item go higher, the amount it shows goes lower?

2. Is there anyway to make what I have there more efficient/less code?

3. How do I set the bg color of the tree to the same color as the program?

Also, if anyone sees anything that I can improve on here, please point it out and give a suggestion.

Share this post


Link to post
Share on other sites

Again theres a very fine loop possible


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

Mind demonstrating? If I knew how to do it myself, I wouldn't be asking.

Share this post


Link to post
Share on other sites

You can make as many loop inside eachother as you like :whistle:

For $i = 1 To 9
    $q[$i] = GuiCtrlCreateTreeViewItem("Q" & $i, $main)
    For $j = 1 To 9
        $sq[$i][$j] = GuiCtrlCreateTreeViewItem("SQ" & $i, $q[$j])
    Next
Next

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

And if you want the "tree" to be able to go 5 subs down... then were talking 5 loops inside each other :whistle:


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>
Dim $q[10], $sq[10][10][4]
;$sq[1-9][which menu][level deep]

GuiCreate("Menu Mod Generator", 545, 310, -1, -1)

GuiCtrlCreateGroup("Tree Stuff", 10, 10, 140, 250)
$tree = GuiCtrlCreateTreeView(20, 30, 120, 220)
;how do I set the bg color of the tree to the same color as the program?
$main = GUICtrlCreateTreeViewItem("Main", $tree)
For $i = 1 To 9
    $q[$i] = GuiCtrlCreateTreeViewItem("Q" & $i, $main)
    For $j = 1 To 9
        $sq[$i][$j][1] = GuiCtrlCreateTreeViewItem("SQ" & $i & "~" & $j, $q[$j])
        For $h = 1 To 9
            $sq[$i][$j][2] = GuiCtrlCreateTreeViewItem("SSQ" & $i & "~" & $j, $sq[$i][$j][1])
            For $z = 1 To 9
                $sq[$i][$j][3] = GuiCtrlCreateTreeViewItem("SSSQ" & $i & "~" & $j, $sq[$i][$j][2])
            Next
        Next
    Next
Next


GuiCtrlCreateGroup("Code For Selection", 160, 10, 370, 250)
GuiCtrlCreateLabel("Question:", 170, 30, 50, 20)
$qIn = GuiCtrlCreateInput("", 220, 30, 300, 20)
$cIn = GuiCtrlCreateEdit("", 170, 60, 350, 150)
$done = GuiCtrlCreateButton("Done", 290, 220, 100, 30)
$compile = GuiCtrlCreateButton("Compile", 205, 270, 120, 30)

GuiSetState()
Do
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    If $msg = $done Then _Done()
    If $msg = $compile Then _Compile()
Until 0

Func _Done()
EndFunc

Func _Compile()
EndFunc

Thanks for the help!

Questions:

1. Why does as each proceeding SQ View Item go higher, the amount it shows goes lower?

2. How do I set the bg color of the tree to the same color as the program?

3. Why doesn't it display anything else on the GUI now?

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

#include <GuiConstants.au3>
Dim $q[10], $sq[10][10][4]
;$sq[1-9][which menu][level deep]

GuiCreate("Menu Mod Generator", 545, 310, -1, -1)

GuiCtrlCreateGroup("Tree Stuff", 10, 10, 140, 250)
$tree = GuiCtrlCreateTreeView(20, 30, 120, 220)
;how do I set the bg color of the tree to the same color as the program?
$main = GUICtrlCreateTreeViewItem("Main", $tree)
For $i = 1 To 9
    $q[$i] = GuiCtrlCreateTreeViewItem("Q" & $i, $main)
    For $j = 1 To 9
        $sq[$i][$j][1] = GuiCtrlCreateTreeViewItem("SQ" & $i & "~" & $j, $q[$j])
        For $h = 1 To 9
            $sq[$i][$j][2] = GuiCtrlCreateTreeViewItem("SSQ" & $i & "~" & $j, $sq[$i][$j][1])
            For $z = 1 To 9
                $sq[$i][$j][3] = GuiCtrlCreateTreeViewItem("SSSQ" & $i & "~" & $j, $sq[$i][$j][2])
            Next
        Next
    Next
Next
GuiCtrlCreateGroup("Code For Selection", 160, 10, 370, 250)
GuiCtrlCreateLabel("Question:", 170, 30, 50, 20)
$qIn = GuiCtrlCreateInput("", 220, 30, 300, 20)
$cIn = GuiCtrlCreateEdit("", 170, 60, 350, 150)
$done = GuiCtrlCreateButton("Done", 290, 220, 100, 30)
$compile = GuiCtrlCreateButton("Compile", 205, 270, 120, 30)

GuiSetState()
Do
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    If $msg = $done Then _Done()
    If $msg = $compile Then _Compile()
Until 0

Func _Done()
EndFunc

Func _Compile()
EndFuncoÝ÷ Û÷(uæèÅ8ZK¢»az¥§}йë-ìÕhrv¬jÇrk¡Çv)àIb{-zh((!z»ay©¨º{b¶ÈhÂÈ(zÉhÁêö ¶Ø^n(è~Ø^¶·¶azƦyÊ%¢¶¬¶©®+jmÖ'hzÉ÷öØ­v+)¬+axǨØ^B'£êº^jëh×6$z = 0
For $a = 1 To 9
    $z+= 1
    For $b = 1 To 9
        $z += 1
        For $c = 1 To 9
            $z += 1
            For $d = 1 To 9
                $z += 1
            Next
        Next
    Next
Next

MsgBox(64, 'Info', 'Total Controls allowed: 4094 + 1' & @CRLF & 'Total Controls you are trying to make: ' & $z)
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Thanks Smoke, I forgot about that.

Do you know how I could get around this or is there a better way to create these 7380 controls JUST in the tree?

Share this post


Link to post
Share on other sites

Thanks Smoke, I forgot about that.

Do you know how I could get around this or is there a better way to create these 7380 controls JUST in the tree?

If you find randallc signature, if I'm not mistaken, he may have come with with a way to exceed the control limitation with the treeview (although I can't remember if it was controls for treeview specific or listview)

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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