Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

How do I delete a Treeview child?


  • Please log in to reply
16 replies to this topic

#1 AoRaToS

AoRaToS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 358 posts

Posted 23 August 2008 - 08:55 PM

Like the title says. how can I delete a single TreeView child??Or do I have to redraw the treeview without that item cause that would be a stupid workaround...

s!mpL3 LAN Messenger


Current version 2.9.8.4 [14/09/2014]


Download Here

s!mpL3








#2 AoRaToS

AoRaToS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 358 posts

Posted 24 August 2008 - 08:52 AM

BUMP...nobody knows if it's possible?????????????

Edited by AoRaToS, 24 August 2008 - 09:05 AM.

s!mpL3 LAN Messenger


Current version 2.9.8.4 [14/09/2014]


Download Here

s!mpL3


#3 Uten

Uten

    stupid is as stupid does..

  • Active Members
  • PipPipPipPipPipPip
  • 1,989 posts

Posted 24 August 2008 - 09:36 AM

Just a hint. One search for TreeView in the help file and what do you get on line 10, 11 and 12?

It's even a nice little sample for you to try out in there. So how f** hard can it be? People spent real time to provide you with a state of the art help file but do you bother to look in it? That is showing disrespect, shame on you!

Now, if the sample does not work, that's another story. but then you should let us know and post some sample code demonstrating your problem.

;) Uten

PS: I know some of the TreeView samples don't work on w2k without some simple tweaking.

#4 AoRaToS

AoRaToS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 358 posts

Posted 24 August 2008 - 09:47 AM

I can't see anything that will delete a treeview child, only a udf tha deletes all the children,enlighten me

s!mpL3 LAN Messenger


Current version 2.9.8.4 [14/09/2014]


Download Here

s!mpL3


#5 Uten

Uten

    stupid is as stupid does..

  • Active Members
  • PipPipPipPipPipPip
  • 1,989 posts

Posted 24 August 2008 - 09:58 AM

_GUICtrlTreeView_Delete: Removes an item and all its children

You want to remove the item but not the children without moving them?

#6 Uten

Uten

    stupid is as stupid does..

  • Active Members
  • PipPipPipPipPipPip
  • 1,989 posts

Posted 24 August 2008 - 10:00 AM

This is probably more like it for you: _GUICtrlTreeView_DeleteChildren : Deletes all children of a item
Line 12 as I pointed you to in my first post.

#7 Uten

Uten

    stupid is as stupid does..

  • Active Members
  • PipPipPipPipPipPip
  • 1,989 posts

Posted 24 August 2008 - 10:01 AM

And when I think of it. A children is an item? So _GUICtrlTreeView_Delete should work on children as an item to?

#8 AoRaToS

AoRaToS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 358 posts

Posted 24 August 2008 - 10:08 AM

I want to remove one single Child from an item

ITEM
--->child1
--->child2

How can I delete child 2?

s!mpL3 LAN Messenger


Current version 2.9.8.4 [14/09/2014]


Download Here

s!mpL3


#9 Uten

Uten

    stupid is as stupid does..

  • Active Members
  • PipPipPipPipPipPip
  • 1,989 posts

Posted 24 August 2008 - 10:16 AM

Get the handle of the child and modify the helpfile sample
            $child = _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y), $iImage, $iImage)         Next     Next     _GUICtrlTreeView_EndUpdate($hTreeView)ƒo݊÷ Ù«­¢+Ø$$%5͝ ½à ÐÄØÀ°€™ÅÕ½Ðí%¹™½Éµ…Ñ¥½¸™ÅÕ½Ð찀™ÅÕ½Ð핱•Ñ”€™ÅÕ½Ð쀙…µÀìMÑÉ¥¹½Éµ…Ð ™ÅÕ½Ðíl”Àɑt9•Ü%ѕ´™ÅÕ½Ð찀˜ŒÀÌØíà´Ä¤€™…µÀ쀙ÅÕ½Ðì´´˜ŒØÈ쀙ÅÕ½Ð쀙…µÀìMÑÉ¥¹½Éµ…Ð ™ÅÕ½Ðíl”Àɑt9•Ü ¡¥±™ÅÕ½Ð찀˜ŒÀÌØíä´Ä¤¤($$%}U% ÑɱQɕ•Y¥•Ý}•±•Ñ” ˜ŒÀÌØí¡Qɕ•Y¥•Ü°€˜ŒÀÌØ퍡¥±


#10 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,717 posts

Posted 24 August 2008 - 10:18 AM

I want to remove one single Child from an item

ITEM
--->child1
--->child2

How can I delete child 2?


Look at:
_GUICtrlTreeView_GetFirstItem
_GUICtrlTreeView_GetFirstChild
_GUICtrlTreeView_GetNextSibling
_GUICtrlTreeView_Delete

#11 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 24 August 2008 - 10:20 AM

OMG! RTFM mate, you're getting brilliant help, yet you ain't trying one bit!

So here you go. Your answer. Plucked it ALL from in the example in the help file that Uten mentioned. Amazing aint it?

Plain Text         
#include <GUIConstants.au3> #Include <GuiTreeView.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AForm1", 183, 175, 193, 115) $hTreeView = GUICtrlCreateTreeView(8, 8, 169, 129) $parent_1 = _GUICtrlTreeView_Add($hTreeView, 0, "Parent 1") $parent_2 = _GUICtrlTreeView_Add($hTreeView, 0, "Parent 2") $child_1_1 = _GUICtrlTreeView_AddChild($hTreeView, $parent_1, "Child 1") $child_1_2 = _GUICtrlTreeView_AddChild($hTreeView, $parent_1, "Child 2") $child_1_3 = _GUICtrlTreeView_AddChild($hTreeView, $parent_1, "Child 3") $child_2_1 = _GUICtrlTreeView_AddChild($hTreeView, $parent_2, "Child 4") $child_2_2 = _GUICtrlTreeView_AddChild($hTreeView, $parent_2, "Child 4") $child_2_2_1 = _GUICtrlTreeView_AddChild($hTreeView, $child_2_2, "Child 5") $Button1 = GUICtrlCreateButton("Exit", 16, 144, 75, 25, 0) $Button2 = GUICtrlCreateButton("Delete Child 3", 96, 144, 75, 25, 0) _GUICtrlTreeView_Expand($hTreeView) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit         Case $Button1             Exit         Case $Button2             $ret = _GUICtrlTreeView_Delete ($hTreeView, $child_1_3)     EndSwitch WEnd


#12 AoRaToS

AoRaToS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 358 posts

Posted 24 August 2008 - 10:20 AM

I don't think that'll work, even if it does, that's adding a child and deleting in, I want to search for achild ad delete it, how hard can it be?nothing seems to work

s!mpL3 LAN Messenger


Current version 2.9.8.4 [14/09/2014]


Download Here

s!mpL3


#13 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 24 August 2008 - 10:22 AM

Start from the beginning. What exactly do you want to achieve. Add lots of detail and pictures. Then we can help. Cause this is going nowhere.

Cheers,

Brett

#14 Uten

Uten

    stupid is as stupid does..

  • Active Members
  • PipPipPipPipPipPip
  • 1,989 posts

Posted 24 August 2008 - 10:23 AM

I don't think that'll work, even if it does, that's adding a child and deleting in, I want to search for achild ad delete it, how hard can it be?nothing seems to work

Adding new information proving that you did not look to hard in the help file does not help much.
And *ROLF* Your new question is already answered above:D

I'm sorry I'm just in that mood this morning..;)

#15 AoRaToS

AoRaToS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 358 posts

Posted 24 August 2008 - 10:25 AM

Ok my friend, that's more like help, take a look at my script:

Plain Text         
#include <GuiConstantsEx.au3> #include <GuiTreeView.au3> #include <GuiImageList.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> #include <StaticConstants.au3> #include <String.au3> Opt("GUIOnEventMode",1) Opt("TrayMenuMode",1) TraySetIcon("Shell32.dll",16) Global $LANTree, $Online, $NETVIEW Global $PrivateIP = @IPAddress1 Global $serversocket = 0 Global $signonclientip, $contactcast, $changeaddress, $contactdata MainGUI() Contacts() ;Messenger() Func Messenger()     UDPStartup()     $chatserver = UDPBind($PrivateIP, 65333)     TrayTip("", "LAN Talk: " & @ComputerName & "(" & $PrivateIP & ")", 5)     Sleep(3000)     If @error <> 0 Then         TrayTip("", @error, 10)         Call ("OnExit")     Else         While 1             $data = UDPRecv($chatserver, 5000)             If $data <> "" Then                 MsgBox(0,"a",$data)             EndIf             sleep(100)         WEnd     EndIf EndFunc Func Contacts() ;start contact server     UDPStartup()     $contactserver = UDPBind($PrivateIP, 65335)     TrayTip("", "LAN Talk: " & @ComputerName & "(" & $PrivateIP & ")", 5)     Sleep(500) ;create multicast address     $splitaddress = StringSplit($PrivateIP, ".")     $changeaddress = $splitaddress[1] & "." & $splitaddress[2] & "." & $splitaddress[3] & "." & "255" ;send packet     $contactcast = UDPOpen($changeaddress, 65335)     UDPSend($contactcast, "SIGN-ON" & $PrivateIP & "|" & @ComputerName)     UDPCloseSocket($contactcast)     While 1         $contactdata = UDPRecv($contactserver, 50)         If $contactdata <> "" Then             If StringLeft($contactdata,7) = "SIGN-ON" Then                 $signonclientipname = StringMid($contactdata, 8)                 $signonclient = StringSplit($signonclientipname, "|")                 $signonclientip = $signonclient[1]                 $signonclientname = $signonclient[2]                 $signonclientid = $signonclientname & " - " & $signonclientip                 If $signonclientip <> $PrivateIP Then                     $signonsearchclient = _GUICtrlTreeView_FindItem($NETVIEW,$signonclientid)                     If $signonsearchclient = 0 Then                         GUICtrlCreateTreeViewItem($signonclientid, $NETVIEW)                         GUICtrlSetState($NETVIEW, BitOR($GUI_EXPAND, $GUI_DEFBUTTON))                     ;Call("Clientmsg")                     EndIf                 EndIf             EndIf             If StringLeft($contactdata,8) = "SIGN-OFF" Then                 $signoffclientipname = StringMid($contactdata, 9)                 $signoffclient = StringSplit($signoffclientipname, "|")                 $signoffclientip = $signoffclient[1]                 $signoffclientname = $signoffclient[2]                 $signoffclientid = $signoffclientname & " - " & $signoffclientip                 MsgBox(0,".",$signoffclientid)                 $signoffsearchclient = _GUICtrlTreeView_FindItem($NETVIEW,$signoffclientid)                 If $signoffsearchclient Then                     MsgBox(0,".",$signoffsearchclient)                     _GUICtrlTreeView_Delete($NETVIEW,$signoffsearchclient)                 EndIf             EndIf         EndIf         Sleep(100)     WEnd EndFunc Func MainGUI()     GUICreate("LAN Talk", 204, 404)     $LANTree = GUICtrlCreateTreeView(2, 2, 200, 400, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)     $NETVIEW = GUICtrlCreateTreeViewItem("Local Network", $LANTree)     GUISetOnEvent($GUI_EVENT_CLOSE,"OnExit")     GUICtrlSetColor(-1, 0x0000C0)     GUICtrlSetState($NETVIEW, BitOR($GUI_EXPAND, $GUI_DEFBUTTON))     GUISetState() EndFunc Func OnExit()     $sign_off = UDPOpen($changeaddress, 65335)     UDPSend($sign_off, "SIGN-OFF" & $PrivateIP & "|" & @ComputerName)     UDPCloseSocket($sign_off)     GUIDelete($LANTree)     Exit EndFunc While 1     Sleep(100) WEnd


Check this out:
_GUICtrlTreeView_Delete($NETVIEW,$signoffsearchclient)
I want to delete the one that sends SIGN-OFF...I've tried allot of things :/

s!mpL3 LAN Messenger


Current version 2.9.8.4 [14/09/2014]


Download Here

s!mpL3


#16 Uten

Uten

    stupid is as stupid does..

  • Active Members
  • PipPipPipPipPipPip
  • 1,989 posts

Posted 24 August 2008 - 11:39 AM

There is no way I can check this code as it requires a setup I don't have (you did not provide it)!

As I'm int that mode and your utterly, sorry to say this, stupid way of starting, bumping and replies this topic there is no way I will provide a working sample.
Post a modified helpfile sample that proves you have tried it. Helpfile sample + the code I posted above should give plenty of clues as that is how I did try it..;)
You may have to change the *AddIcon stuff to
    Local $offset=0     _GUIImageList_AddIcon($hImage, "shell32.dll", $offset + 10)     _GUIImageList_AddIcon($hImage, "shell32.dll", $offset + 31)     _GUIImageList_AddIcon($hImage, "shell32.dll", $offset + 65)     _GUIImageList_AddIcon($hImage, "shell32.dll", $offset + 68)     _GUIImageList_AddIcon($hImage, "shell32.dll", $offset + 37)     _GUIImageList_AddIcon($hImage, "shell32.dll", $offset + 46)
to get it going. Depends on the OS, I don't know.

#17 AoRaToS

AoRaToS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 358 posts

Posted 25 August 2008 - 03:00 PM

You shouldn't be talking like that, the support forum is for asking and providing help not for making people feel stupid cause they didn't specify exactly.you can see the problem without having to have a local network, I believe the treeview find doesn't return the handle correctly and I can't see why, I'll try and find the solution by myself and post soon...

s!mpL3 LAN Messenger


Current version 2.9.8.4 [14/09/2014]


Download Here

s!mpL3





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users