i've recently had a go at making a treeview switchbar, all was good until i spotted a small problem, when i click the 'Dcc' part of the menu
i get this error * No such connection id: 1
The bit i click that causes that error is also in blue.

here's the code that causes the problem, i hope some can help frown

Code:
 alias load.switchbar {
  did -r switchbar 1
  did -i switchbar 1 1 iconsize normal small
  did -i switchbar 1 1 seticon normal $mircdirsystem/icons/server.ico
  did -i switchbar 1 1 seticon normal $mircdirsystem/icons/chan.ico
  did -i switchbar 1 1 seticon normal $mircdirsystem/icons/chan.ico
  did -i switchbar 1 1 seticon normal $mircdirsystem/icons/chan.ico
  did -i switchbar 1 1 seticon normal $mircdirsystem/icons/chan.ico
  did -i switchbar 1 1 seticon normal $mircdirsystem/icons/chan.ico
  did -i switchbar 1 1 seticon normal $mircdirsystem/icons/chan.ico
  var %a = 1
  while (%a <= $scid(0)) {
    scon %a
    did -i switchbar 1 1 cb root
    did -a switchbar 1 +eb 1 1 $iif($scid(%a).network == $null,Not Connected,$scid(%a).network)
    did -i switchbar 1 1 cb last
    did -a switchbar 1 +e 2 2 Channels
    did -i switchbar 1 1 cb last
    var %x = 1
    while (%x <= $chan(0)) {
      did -a switchbar 1 + 2 2 $chan(%x)
      inc %x
    }
    did -i switchbar 1 1 cb up
    did -a switchbar 1 +e 3 3 Queries
    did -i switchbar 1 1 cb last
    var %x = 1
    while (%x <= $query(0)) {
      did -a switchbar 1 + 3 3 $query(%x)
      inc %x
    }
    inc %a
  }
  did -i switchbar 1 1 cb up
  did -i switchbar 1 1 cb up
  did -i switchbar 1 1 cb root
  [color:blue]did -a switchbar 1 +eb 7 7 DCC[/color]
  did -i switchbar 1 1 cb last
  did -a switchbar 1 + 7 7 Get
  did -i switchbar 1 1 cb last
  var %x = 1
  while (%x <= $get(0)) {
    did -a switchbar 1 + 7 7 $get(%x)
    inc %x
  }
  did -i switchbar 1 1 cb up
  did -a switchbar 1 + 7 7 Send
  did -i switchbar 1 1 cb last
  var %x = 1
  while (%x <= $send(0)) {
    did -a switchbar 1 + 7 7 $send(%x)
    inc %x
  }
  did -i switchbar 1 1 cb up
  did -a switchbar 1 + 7 7 Chat
  did -i switchbar 1 1 cb last
  var %x = 1
  while (%x <= $chat(0)) {
    did -a switchbar 1 + 7 7 $chat(%x)
    inc %x
  }
  did -i switchbar 1 1 cb up
}