Sign in to follow this  
Followers 0
Kyme

GUICtrlCreateTreeView help

9 posts in this topic

i wanna make one tree whit skins...when i click one tree item to GUICtrlSetImage some pic and when i press the $but to show skin name....

how to make it???i try this...but when i press $but script msg me all skins....what it's wrong on it???

#include <GUIConstants.au3>

$Pic="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg"
$Form2 = GUICreate("AForm2", 500, 360, 258, 125)
$Tree = GUICtrlCreateTreeView(24, 56, 185, 265)
$Skin = GUICtrlCreateTreeViewItem("Skins", $Tree)
$s1 = GUICtrlCreateTreeViewItem("BlackJack", $Skin)
$s2 = GUICtrlCreateTreeViewItem("Blue-Metal", $Skin)
$s3 = GUICtrlCreateTreeViewItem("Carbon", $Skin)
$s4 = GUICtrlCreateTreeViewItem("DarkRed", $Skin)
$s5 = GUICtrlCreateTreeViewItem("HeavenlyBodies", $Skin)
$s6 = GUICtrlCreateTreeViewItem("Leadore", $Skin)
$s7 = GUICtrlCreateTreeViewItem("Light-Blue", $Skin)
$s8 = GUICtrlCreateTreeViewItem("Light-Green", $Skin)
$s9 = GUICtrlCreateTreeViewItem("Lizondo", $Skin)
$s10 = GUICtrlCreateTreeViewItem("MsgPlus!", $Skin)
$s11 = GUICtrlCreateTreeViewItem("Noir", $Skin)
$s12 = GUICtrlCreateTreeViewItem("Rezak", $Skin)
$s13 = GUICtrlCreateTreeViewItem("Silent-green", $Skin)
$s14 = GUICtrlCreateTreeViewItem("Universal", $Skin)
$s15 = GUICtrlCreateTreeViewItem("XP-Shutdown", $Skin)
$Pic1 = GUICtrlCreatePic($pic, 232, 56, 257, 265, BitOR($SS_NOTIFY,$WS_GROUP))
GUISetState(@SW_SHOW)

$but=Guictrlcreatebutton("Set", 255, 32, 20,20)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        EndSwitch
    IF $nmsg= $s1 then GUICtrlSetImage($Pic1,"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg")
        If $nmsg= $but Then
        MsgBox(0,"","BlackJack")
    EndIf
    If $nmsg= $s2 then GUICtrlSetImage($Pic1,"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg")
        If $nmsg= $but Then
        MsgBox(0,"","Blue-Metal")
    EndIf
WEnd

wait advice

tnx

Share this post


Link to post
Share on other sites



You mean like this...

#include <GUIConstants.au3>

$Pic="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg"
$Form2 = GUICreate("AForm2", 500, 360, 258, 125)
$Tree = GUICtrlCreateTreeView(24, 56, 185, 265)
$Skin = GUICtrlCreateTreeViewItem("Skins", $Tree)
$s1 = GUICtrlCreateTreeViewItem("BlackJack", $Skin)
$s2 = GUICtrlCreateTreeViewItem("Blue-Metal", $Skin)
$s3 = GUICtrlCreateTreeViewItem("Carbon", $Skin)
$s4 = GUICtrlCreateTreeViewItem("DarkRed", $Skin)
$s5 = GUICtrlCreateTreeViewItem("HeavenlyBodies", $Skin)
$s6 = GUICtrlCreateTreeViewItem("Leadore", $Skin)
$s7 = GUICtrlCreateTreeViewItem("Light-Blue", $Skin)
$s8 = GUICtrlCreateTreeViewItem("Light-Green", $Skin)
$s9 = GUICtrlCreateTreeViewItem("Lizondo", $Skin)
$s10 = GUICtrlCreateTreeViewItem("MsgPlus!", $Skin)
$s11 = GUICtrlCreateTreeViewItem("Noir", $Skin)
$s12 = GUICtrlCreateTreeViewItem("Rezak", $Skin)
$s13 = GUICtrlCreateTreeViewItem("Silent-green", $Skin)
$s14 = GUICtrlCreateTreeViewItem("Universal", $Skin)
$s15 = GUICtrlCreateTreeViewItem("XP-Shutdown", $Skin)
$Pic1 = GUICtrlCreatePic($pic, 232, 56, 257, 265, BitOR($SS_NOTIFY,$WS_GROUP))
GUISetState(@SW_SHOW)

$but=Guictrlcreatebutton("Set", 255, 32, 20,20)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        EndSwitch
    IF $nmsg= $s1 then 
    GUICtrlSetImage($Pic1,"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg")
    MsgBox(0,"","BlackJack")
    EndIf
        
    If $nmsg= $s2 then 
    GUICtrlSetImage($Pic1,"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg")
    MsgBox(0,"","Blue-Metal")
    EndIf
WEnd

Share this post


Link to post
Share on other sites

no only when i press the $but to MsgBox(0,"","skin name")

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
#include <GuiTreeView.au3>

$Pic="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg"
$Form2 = GUICreate("AForm2", 500, 360, 258, 125)
$Tree = GUICtrlCreateTreeView(24, 56, 185, 265)
$Skin = GUICtrlCreateTreeViewItem("Skins", $Tree)
$s1 = GUICtrlCreateTreeViewItem("BlackJack", $Skin)
$s2 = GUICtrlCreateTreeViewItem("Blue-Metal", $Skin)
$s3 = GUICtrlCreateTreeViewItem("Carbon", $Skin)
$s4 = GUICtrlCreateTreeViewItem("DarkRed", $Skin)
$s5 = GUICtrlCreateTreeViewItem("HeavenlyBodies", $Skin)
$s6 = GUICtrlCreateTreeViewItem("Leadore", $Skin)
$s7 = GUICtrlCreateTreeViewItem("Light-Blue", $Skin)
$s8 = GUICtrlCreateTreeViewItem("Light-Green", $Skin)
$s9 = GUICtrlCreateTreeViewItem("Lizondo", $Skin)
$s10 = GUICtrlCreateTreeViewItem("MsgPlus!", $Skin)
$s11 = GUICtrlCreateTreeViewItem("Noir", $Skin)
$s12 = GUICtrlCreateTreeViewItem("Rezak", $Skin)
$s13 = GUICtrlCreateTreeViewItem("Silent-green", $Skin)
$s14 = GUICtrlCreateTreeViewItem("Universal", $Skin)
$s15 = GUICtrlCreateTreeViewItem("XP-Shutdown", $Skin)
$Pic1 = GUICtrlCreatePic($pic, 232, 56, 257, 265, BitOR($SS_NOTIFY,$WS_GROUP))
GUISetState(@SW_SHOW)

$but=Guictrlcreatebutton("Set", 255, 32, 20,20)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        
        Case $but
        $item=_GUICtrlTreeView_GetSelection($Tree)
        $Selection=_GUICtrlTreeView_GetText($Tree, $item)
    
        MsgBox(4096,"",$Selection)

    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

i wanna make it when i select one tree item to show skin pic and if i press $but to set skin(for example func setskin() )...(i add the msgbox option to be simply understandeble)

you can do that please??

tnx

Edited by Kyme

Share this post


Link to post
Share on other sites

nobody know how to make it???:)

Share this post


Link to post
Share on other sites

@Kyme...With your code..there is no way you can display the pictures..you will need to add the location to the pictures for the treeview items somewhere in the code....look in the help file for the treeview UDFs examples....

I can do this for you but whats the point...if you want to learn u need to try it out and post your script...

Share this post


Link to post
Share on other sites

@Kyme...With your code..there is no way you can display the pictures..you will need to add the location to the pictures for the treeview items somewhere in the code....look in the help file for the treeview UDFs examples....

I can do this for you but whats the point...if you want to learn u need to try it out and post your script...

i understand you...but really i didn't have some damn ideea:((...i waist 4 houres trying to make it and nothing...:)

Share this post


Link to post
Share on other sites

ohhh...at last i made it:D:D:D

#include <GUIConstants.au3>
#include <XSkin.au3>

Global $Skin_Folder =  Iniread("C:\data.dll", "Settings", "Skin", "")
Global $Pic= @ScriptDir & "\default.JPG"


$Menu1 = XSkinGUICreate("AForm1", 633, 447,$Skin_Folder)
$Tree = GUICtrlCreateTreeView(56, 56, 265, 337)
$s1 = GUICtrlCreateTreeViewItem("BlackJack", $Tree)
$s2 = GUICtrlCreateTreeViewItem("Blue-Metal", $Tree)
$s3 = GUICtrlCreateTreeViewItem("Carbon", $Tree)
$s4 = GUICtrlCreateTreeViewItem("DarkRed", $Tree)
$s5 = GUICtrlCreateTreeViewItem("HeavenlyBodies", $Tree)
$s6 = GUICtrlCreateTreeViewItem("Leadore", $Tree)
$s7 = GUICtrlCreateTreeViewItem("Light-Blue", $Tree)
$s8 = GUICtrlCreateTreeViewItem("Light-Green", $Tree)
$s9 = GUICtrlCreateTreeViewItem("Lizondo", $Tree)
$s10 = GUICtrlCreateTreeViewItem("MsgPlus!", $Tree)
$s11 = GUICtrlCreateTreeViewItem("Noir", $Tree)
$s12 = GUICtrlCreateTreeViewItem("Rezak", $Tree)
$s13 = GUICtrlCreateTreeViewItem("Silent-green", $Tree)
$s14 = GUICtrlCreateTreeViewItem("Universal", $Tree)
$s15 = GUICtrlCreateTreeViewItem("XP-Shutdown", $Tree)
$Pic1 = GUICtrlCreatePic($pic, 336, 56, 241, 337, BitOR($SS_NOTIFY,$WS_GROUP))
GUISetState(@SW_SHOW)

$menu8h = Guictrlcreatebutton("X", 615, 4, 15,15)
GUICtrlSetColor(-1, 0xFF0404)
$but=Guictrlcreatebutton("Set", 308, 413, 30,20)
While 1
    $Msg = GUIGetMsg()
    select
        case $msg=-3 or $msg= $menu8h
            Exit
        case $msg=$s1
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/BlackJack.JPG")
        case $msg=$s2
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/Blue%2DMetal.JPG")
        case $msg=$s3
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/Carbon.JPG")
        case $msg=$s4
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/DarkRed.JPG")
        case $msg=$s5
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/HeavenlyBodies.JPG")
        case $msg=$s6
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/Leadore.JPG")
        case $msg=$s7
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/Light%2DBlue.JPG")
        case $msg=$s8
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/Light%2DGreen.JPG")
        case $msg=$s9
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/Lizondo.JPG")
        case $msg=$s10
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/MsgPlus.JPG")
        case $msg=$s11
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/Noir.JPG")
        case $msg=$s12
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/Rezak.JPG")
        case $msg=$s13
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/Silent%2Dgreen.JPG")
        case $msg=$s14
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/Universal.JPG")
        case $msg=$s15
            $B_oIE3 = ObjCreate("Shell.Explorer.2") 
            $Breaktime = GUICtrlCreateObj($B_oIE3, 336, 56, 241, 337) 
            $B_oIE3.navigate ("http://kyme32.webs.com/UH7/XP%2DShutdown.JPG")

        Case $msg = $but
            $item = GUICtrlRead($Tree)
            If $item = 0 Then
                MsgBox(64, "TreeView Demo", "No item currently selected")
                Else
                $text = GUICtrlRead($item, 1)
                    If $text = "" Then
                        MsgBox(16, "Error", "Error while retrieving infos about item")
                    Else
                            GUISetState(@SW_HIDE, $Menu1)
                            ToolTip(" ",450,-1,"Setting Skin...",4144)
                            sleep(2000)
                            MsgBox(64, "Info", 'You Choise "' & $text & '" Skin')
                            IniWrite("C:\data.dll", "Settings", "Skin", "C:\Program Files\UH7\Skins\" & $Text)
                            Run("UH7.exe")
                                Exit
                    EndIf
            EndIf
    EndSelect
WEnd

it work awesome:D

i think this is record...aprox 8h to make one simple script....lolz

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