Jump to content
Sign in to follow this  
sumit

Problem with selecting control in GUI

Recommended Posts

sumit

Please run this code. In this code i want the message box to appear only when I select "Create VLAN on Switch" and then press ok. However whenever Im pressing ok the messagebox is appearing. Please correct this if possible .

CODE
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\desktop\sumit\aform1.kxf

$Form1 = GUICreate("AForm1", 350, 247, 303, 219)

$TreeView1 = GUICtrlCreateTreeView(24, 16, 305, 201)

$TreeView1_0 = GUICtrlCreateTreeViewItem("M2404", $TreeView1)

$TreeView1_1 = GUICtrlCreateTreeViewItem("Create VLAN on Switch", $TreeView1_0)

$TreeView1_2 = GUICtrlCreateTreeViewItem("VLAN Configuration for Gigabitethernet port", $TreeView1_0)

$TreeView1_3 = GUICtrlCreateTreeViewItem("VLAN Configuration for Fastethernet Port", $TreeView1_0)

$TreeView1_4 = GUICtrlCreateTreeViewItem("R1722G", $TreeView1)

$TreeView1_5 = GUICtrlCreateTreeViewItem("NOC R1722G", $TreeView1_4)

$TreeView1_6 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_5)

$TreeView1_7 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_5)

$TreeView1_8 = GUICtrlCreateTreeViewItem("Remote R1722G", $TreeView1_4)

$TreeView1_9 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_8)

$TreeView1_10 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_8)

$Button1 = GUICtrlCreateButton("OK", 256, 224, 75, 17, 0)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

if $nMsg = $Button1 then

if GUICtrlRead($TreeView1_1) = 'Create VLAN on Switch' Then

MsgBox(4096, "hello", "hello")

EndIf

Endif

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Edited by sumit

Share this post


Link to post
Share on other sites
FireLord

Please run this code. In this code i want the message box to appear only when I select "Create VLAN on Switch" and then press ok. However whenever Im pressing ok the messagebox is appearing. Please correct this if possible .

CODE
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\desktop\sumit\aform1.kxf

$Form1 = GUICreate("AForm1", 350, 247, 303, 219)

$TreeView1 = GUICtrlCreateTreeView(24, 16, 305, 201)

$TreeView1_0 = GUICtrlCreateTreeViewItem("M2404", $TreeView1)

$TreeView1_1 = GUICtrlCreateTreeViewItem("Create VLAN on Switch", $TreeView1_0)

$TreeView1_2 = GUICtrlCreateTreeViewItem("VLAN Configuration for Gigabitethernet port", $TreeView1_0)

$TreeView1_3 = GUICtrlCreateTreeViewItem("VLAN Configuration for Fastethernet Port", $TreeView1_0)

$TreeView1_4 = GUICtrlCreateTreeViewItem("R1722G", $TreeView1)

$TreeView1_5 = GUICtrlCreateTreeViewItem("NOC R1722G", $TreeView1_4)

$TreeView1_6 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_5)

$TreeView1_7 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_5)

$TreeView1_8 = GUICtrlCreateTreeViewItem("Remote R1722G", $TreeView1_4)

$TreeView1_9 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_8)

$TreeView1_10 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_8)

$Button1 = GUICtrlCreateButton("OK", 256, 224, 75, 17, 0)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

if $nMsg = $Button1 then

if GUICtrlRead($TreeView1_1) = 'Create VLAN on Switch' Then

MsgBox(4096, "hello", "hello")

EndIf

Endif

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Try this:

#include <GUIConstants.au3>
#include <GUITreeView.au3>

#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\desktop\sumit\aform1.kxf
$Form1 = GUICreate("AForm1", 350, 247, 303, 219)
$TreeView1 = GUICtrlCreateTreeView(24, 16, 305, 201)
$TreeView1_0 = GUICtrlCreateTreeViewItem("M2404", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("Create VLAN on Switch", $TreeView1_0)
$TreeView1_2 = GUICtrlCreateTreeViewItem("VLAN Configuration for Gigabitethernet port", $TreeView1_0)
$TreeView1_3 = GUICtrlCreateTreeViewItem("VLAN Configuration for Fastethernet Port", $TreeView1_0)
$TreeView1_4 = GUICtrlCreateTreeViewItem("R1722G", $TreeView1)
$TreeView1_5 = GUICtrlCreateTreeViewItem("NOC R1722G", $TreeView1_4)
$TreeView1_6 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_5)
$TreeView1_7 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_5)
$TreeView1_8 = GUICtrlCreateTreeViewItem("Remote R1722G", $TreeView1_4)
$TreeView1_9 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_8)
$TreeView1_10 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_8)
$Button1 = GUICtrlCreateButton("OK", 256, 224, 75, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
if $nMsg = $Button1 then
$h_item = _GUICtrlTreeViewGetText($treeview1, $TreeView1_1)
if GUICtrlRead($h_item) = 'Create VLAN on Switch' Then
MsgBox(4096, "hello", "hello")
EndIf
Endif
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd

[center]See the Helpfile[/center]
While Alive()
	 DrinkWine();
}
[center][/center]

Share this post


Link to post
Share on other sites
sumit

Try this:

#include <GUIConstants.au3>
#include <GUITreeView.au3>

#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\desktop\sumit\aform1.kxf
$Form1 = GUICreate("AForm1", 350, 247, 303, 219)
$TreeView1 = GUICtrlCreateTreeView(24, 16, 305, 201)
$TreeView1_0 = GUICtrlCreateTreeViewItem("M2404", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("Create VLAN on Switch", $TreeView1_0)
$TreeView1_2 = GUICtrlCreateTreeViewItem("VLAN Configuration for Gigabitethernet port", $TreeView1_0)
$TreeView1_3 = GUICtrlCreateTreeViewItem("VLAN Configuration for Fastethernet Port", $TreeView1_0)
$TreeView1_4 = GUICtrlCreateTreeViewItem("R1722G", $TreeView1)
$TreeView1_5 = GUICtrlCreateTreeViewItem("NOC R1722G", $TreeView1_4)
$TreeView1_6 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_5)
$TreeView1_7 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_5)
$TreeView1_8 = GUICtrlCreateTreeViewItem("Remote R1722G", $TreeView1_4)
$TreeView1_9 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_8)
$TreeView1_10 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_8)
$Button1 = GUICtrlCreateButton("OK", 256, 224, 75, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
if $nMsg = $Button1 then
$h_item = _GUICtrlTreeViewGetText($treeview1, $TreeView1_1)
if GUICtrlRead($h_item) = 'Create VLAN on Switch' Then
MsgBox(4096, "hello", "hello")
EndIf
Endif
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd
STILL NOT WORKING

Even now I have the same problem that whenever im clicking the OK button .... message box is appearing

Share this post


Link to post
Share on other sites
FireLord

STILL NOT WORKING

Even now I have the same problem that whenever im clicking the OK button .... message box is appearing

This should work:

#include <GUIConstants.au3>
#include <GUITreeView.au3>

#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\desktop\sumit\aform1.kxf
$Form1 = GUICreate("AForm1", 350, 247, 303, 219)
$TreeView1 = GUICtrlCreateTreeView(24, 16, 305, 201)
$TreeView1_0 = GUICtrlCreateTreeViewItem("M2404", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("Create VLAN on Switch", $TreeView1_0)
$TreeView1_2 = GUICtrlCreateTreeViewItem("VLAN Configuration for Gigabitethernet port", $TreeView1_0)
$TreeView1_3 = GUICtrlCreateTreeViewItem("VLAN Configuration for Fastethernet Port", $TreeView1_0)
$TreeView1_4 = GUICtrlCreateTreeViewItem("R1722G", $TreeView1)
$TreeView1_5 = GUICtrlCreateTreeViewItem("NOC R1722G", $TreeView1_4)
$TreeView1_6 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_5)
$TreeView1_7 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_5)
$TreeView1_8 = GUICtrlCreateTreeViewItem("Remote R1722G", $TreeView1_4)
$TreeView1_9 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_8)
$TreeView1_10 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_8)
$Button1 = GUICtrlCreateButton("OK", 256, 224, 75, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$msg = GUIGetMsg()
Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit 0
    Case $msg = $Button1
        $h_item = GUICtrlSendMsg($treeview1, $TVM_GETNEXTITEM, $TVGN_CARET, 0)
    ;$h_item = _GUICtrlTreeViewGetText($treeview1, $TreeView1_1)
        If $h_item > 0 Then
            MsgBox(4096, "hello", "hello")
        Else
        EndIf
        EndSelect
WEnd

[center]See the Helpfile[/center]
While Alive()
	 DrinkWine();
}
[center][/center]

Share this post


Link to post
Share on other sites
sumit

This should work:

#include <GUIConstants.au3>
#include <GUITreeView.au3>

#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\desktop\sumit\aform1.kxf
$Form1 = GUICreate("AForm1", 350, 247, 303, 219)
$TreeView1 = GUICtrlCreateTreeView(24, 16, 305, 201)
$TreeView1_0 = GUICtrlCreateTreeViewItem("M2404", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("Create VLAN on Switch", $TreeView1_0)
$TreeView1_2 = GUICtrlCreateTreeViewItem("VLAN Configuration for Gigabitethernet port", $TreeView1_0)
$TreeView1_3 = GUICtrlCreateTreeViewItem("VLAN Configuration for Fastethernet Port", $TreeView1_0)
$TreeView1_4 = GUICtrlCreateTreeViewItem("R1722G", $TreeView1)
$TreeView1_5 = GUICtrlCreateTreeViewItem("NOC R1722G", $TreeView1_4)
$TreeView1_6 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_5)
$TreeView1_7 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_5)
$TreeView1_8 = GUICtrlCreateTreeViewItem("Remote R1722G", $TreeView1_4)
$TreeView1_9 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_8)
$TreeView1_10 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_8)
$Button1 = GUICtrlCreateButton("OK", 256, 224, 75, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$msg = GUIGetMsg()
Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit 0
    Case $msg = $Button1
        $h_item = GUICtrlSendMsg($treeview1, $TVM_GETNEXTITEM, $TVGN_CARET, 0)
;$h_item = _GUICtrlTreeViewGetText($treeview1, $TreeView1_1)
        If $h_item > 0 Then
            MsgBox(4096, "hello", "hello")
        Else
        EndIf
        EndSelect
WEnd

Now its showing messagebox whenever any of the items is selected and i press OK..... I just wanted it to show on one particular item

Share this post


Link to post
Share on other sites
SmOke_N

I don't see you did anything but made a GUI in Koda... reading the help file and looking at their examples would have provided a clue :P

#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\desktop\sumit\aform1.kxf
$Form1 = GUICreate("AForm1", 350, 247, 303, 219)
$TreeView1 = GUICtrlCreateTreeView(24, 16, 305, 201)
$TreeView1_0 = GUICtrlCreateTreeViewItem("M2404", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("Create VLAN on Switch", $TreeView1_0)
$TreeView1_2 = GUICtrlCreateTreeViewItem("VLAN Configuration for Gigabitethernet port", $TreeView1_0)
$TreeView1_3 = GUICtrlCreateTreeViewItem("VLAN Configuration for Fastethernet Port", $TreeView1_0)
$TreeView1_4 = GUICtrlCreateTreeViewItem("R1722G", $TreeView1)
$TreeView1_5 = GUICtrlCreateTreeViewItem("NOC R1722G", $TreeView1_4)
$TreeView1_6 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_5)
$TreeView1_7 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_5)
$TreeView1_8 = GUICtrlCreateTreeViewItem("Remote R1722G", $TreeView1_4)
$TreeView1_9 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_8)
$TreeView1_10 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_8)
$Button1 = GUICtrlCreateButton("OK", 256, 224, 75, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $TreeView1_1
            MsgBox(0, 0, "Create VLAN on Switch")
    EndSwitch
WEnd

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.

Share this post


Link to post
Share on other sites
sumit

I don't see you did anything but made a GUI in Koda... reading the help file and looking at their examples would have provided a clue :P

#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\desktop\sumit\aform1.kxf
$Form1 = GUICreate("AForm1", 350, 247, 303, 219)
$TreeView1 = GUICtrlCreateTreeView(24, 16, 305, 201)
$TreeView1_0 = GUICtrlCreateTreeViewItem("M2404", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("Create VLAN on Switch", $TreeView1_0)
$TreeView1_2 = GUICtrlCreateTreeViewItem("VLAN Configuration for Gigabitethernet port", $TreeView1_0)
$TreeView1_3 = GUICtrlCreateTreeViewItem("VLAN Configuration for Fastethernet Port", $TreeView1_0)
$TreeView1_4 = GUICtrlCreateTreeViewItem("R1722G", $TreeView1)
$TreeView1_5 = GUICtrlCreateTreeViewItem("NOC R1722G", $TreeView1_4)
$TreeView1_6 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_5)
$TreeView1_7 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_5)
$TreeView1_8 = GUICtrlCreateTreeViewItem("Remote R1722G", $TreeView1_4)
$TreeView1_9 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_8)
$TreeView1_10 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_8)
$Button1 = GUICtrlCreateButton("OK", 256, 224, 75, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $TreeView1_1
            MsgBox(0, 0, "Create VLAN on Switch")
    EndSwitch
WEnd
Thanks for the reply. Dont mind but i think you make your judgements a bit quickly. I already know the solution you are providing . The problem is i dont want the message box to appear without pressing OK button after selecting the right option. That is I want that first i should select " Create VLAN on Switch " then if i press OK button the Message Box should appear.

Share this post


Link to post
Share on other sites
SmOke_N

Thanks for the reply. Dont mind but i think you make your judgements a bit quickly. I already know the solution you are providing . The problem is i dont want the message box to appear without pressing OK button after selecting the right option. That is I want that first i should select " Create VLAN on Switch " then if i press OK button the Message Box should appear.

I'll humor you...
Global $bTreeViewSected[11], $iCC
Global $aTreeViewText[11] = ["M2404", "Create VLAN on Switch", "VLAN Configuration for Gigabitethernet port", _
    "VLAN Configuration for Fastethernet Port", "R1722G", "NOC R1722G", "Giving IP Address", _
    "Configuration", "Remote R1722G", "Giving IP Address", "Configuration"]

#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\desktop\sumit\aform1.kxf
$Form1 = GUICreate("AForm1", 350, 247, 303, 219)
$TreeView1 = GUICtrlCreateTreeView(24, 16, 305, 201)
$TreeView1_0 = GUICtrlCreateTreeViewItem("M2404", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("Create VLAN on Switch", $TreeView1_0)
$TreeView1_2 = GUICtrlCreateTreeViewItem("VLAN Configuration for Gigabitethernet port", $TreeView1_0)
$TreeView1_3 = GUICtrlCreateTreeViewItem("VLAN Configuration for Fastethernet Port", $TreeView1_0)
$TreeView1_4 = GUICtrlCreateTreeViewItem("R1722G", $TreeView1)
$TreeView1_5 = GUICtrlCreateTreeViewItem("NOC R1722G", $TreeView1_4)
$TreeView1_6 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_5)
$TreeView1_7 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_5)
$TreeView1_8 = GUICtrlCreateTreeViewItem("Remote R1722G", $TreeView1_4)
$TreeView1_9 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_8)
$TreeView1_10 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_8)
$Button1 = GUICtrlCreateButton("OK", 256, 224, 75, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $TreeView1_0
            _TreeViewToggle(0)
        Case $TreeView1_1
            _TreeViewToggle(1)
        Case $TreeView1_2
            _TreeViewToggle(2)
        Case $Button1
            For $iCC = 0 To 10
                If $bTreeViewSected[$iCC] Then ExitLoop
            Next
            _TreeViewToggle($iCC)
            MsgBox(64, "Info", "You Clicked TreeView: " & $iCC & @CRLF & "Which equals: " & $aTreeViewText[$iCC])
    EndSwitch
WEnd

Func _TreeViewToggle($nNum)
    $bTreeViewSected[$nNum] = Not $bTreeViewSected[$nNum]
    Return
EndFunc

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.

Share this post


Link to post
Share on other sites
SmOke_N

This one makes more sense:

Global $nTreeViewSelected = -1
Global $aTreeViewText[11] = ["M2404", "Create VLAN on Switch", "VLAN Configuration for Gigabitethernet port", _
    "VLAN Configuration for Fastethernet Port", "R1722G", "NOC R1722G", "Giving IP Address", _
    "Configuration", "Remote R1722G", "Giving IP Address", "Configuration"]

#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\desktop\sumit\aform1.kxf
$Form1 = GUICreate("AForm1", 350, 247, 303, 219)
$TreeView1 = GUICtrlCreateTreeView(24, 16, 305, 201)
$TreeView1_0 = GUICtrlCreateTreeViewItem("M2404", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("Create VLAN on Switch", $TreeView1_0)
$TreeView1_2 = GUICtrlCreateTreeViewItem("VLAN Configuration for Gigabitethernet port", $TreeView1_0)
$TreeView1_3 = GUICtrlCreateTreeViewItem("VLAN Configuration for Fastethernet Port", $TreeView1_0)
$TreeView1_4 = GUICtrlCreateTreeViewItem("R1722G", $TreeView1)
$TreeView1_5 = GUICtrlCreateTreeViewItem("NOC R1722G", $TreeView1_4)
$TreeView1_6 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_5)
$TreeView1_7 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_5)
$TreeView1_8 = GUICtrlCreateTreeViewItem("Remote R1722G", $TreeView1_4)
$TreeView1_9 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_8)
$TreeView1_10 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_8)
$Button1 = GUICtrlCreateButton("OK", 256, 224, 75, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $TreeView1_0
            $nTreeViewSelected = 0
        Case $TreeView1_1
            $nTreeViewSelected = 1
        Case $TreeView1_2
            $nTreeViewSelected = 2
        Case $Button1
            If $nTreeViewSelected > -1 Then _
                MsgBox(64, "Info", "You Clicked TreeView: " & $nTreeViewSelected & @CRLF & "Which equals: " & $aTreeViewText[$nTreeViewSelected])
            $nTreeViewSelected = -1
    EndSwitch
WEnd

Edit:

Since I took the array out, I didn't need the toggle.

Edited by SmOke_N

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.

Share this post


Link to post
Share on other sites
sumit

I'll humor you...

Global $bTreeViewSected[11], $iCC
Global $aTreeViewText[11] = ["M2404", "Create VLAN on Switch", "VLAN Configuration for Gigabitethernet port", _
    "VLAN Configuration for Fastethernet Port", "R1722G", "NOC R1722G", "Giving IP Address", _
    "Configuration", "Remote R1722G", "Giving IP Address", "Configuration"]

#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\desktop\sumit\aform1.kxf
$Form1 = GUICreate("AForm1", 350, 247, 303, 219)
$TreeView1 = GUICtrlCreateTreeView(24, 16, 305, 201)
$TreeView1_0 = GUICtrlCreateTreeViewItem("M2404", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("Create VLAN on Switch", $TreeView1_0)
$TreeView1_2 = GUICtrlCreateTreeViewItem("VLAN Configuration for Gigabitethernet port", $TreeView1_0)
$TreeView1_3 = GUICtrlCreateTreeViewItem("VLAN Configuration for Fastethernet Port", $TreeView1_0)
$TreeView1_4 = GUICtrlCreateTreeViewItem("R1722G", $TreeView1)
$TreeView1_5 = GUICtrlCreateTreeViewItem("NOC R1722G", $TreeView1_4)
$TreeView1_6 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_5)
$TreeView1_7 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_5)
$TreeView1_8 = GUICtrlCreateTreeViewItem("Remote R1722G", $TreeView1_4)
$TreeView1_9 = GUICtrlCreateTreeViewItem("Giving IP Address", $TreeView1_8)
$TreeView1_10 = GUICtrlCreateTreeViewItem("Configuration", $TreeView1_8)
$Button1 = GUICtrlCreateButton("OK", 256, 224, 75, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $TreeView1_0
            _TreeViewToggle(0)
        Case $TreeView1_1
            _TreeViewToggle(1)
        Case $TreeView1_2
            _TreeViewToggle(2)
        Case $Button1
            For $iCC = 0 To 10
                If $bTreeViewSected[$iCC] Then ExitLoop
            Next
            _TreeViewToggle($iCC)
            MsgBox(64, "Info", "You Clicked TreeView: " & $iCC & @CRLF & "Which equals: " & $aTreeViewText[$iCC])
    EndSwitch
WEnd

Func _TreeViewToggle($nNum)
    $bTreeViewSected[$nNum] = Not $bTreeViewSected[$nNum]
    Return
EndFunc
Thanks for the solution. Really appreciate it. And advice taken in the Private message

Share this post


Link to post
Share on other sites
SmOke_N

Thanks for the solution. Really appreciate it. And advice taken in the Private message

Read the 2nd one, and the edit I just made.

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.

Share this post


Link to post
Share on other sites
sumit

Read the 2nd one, and the edit I just made.

Thanks .... makes it easier to understand

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  

×