alias startev {
  /z connection
}

dialog connection {
  title "Funny Connection"
  size -1 -2 296 199
  option pixels
  button "OK", 601, 10 290 280 20
  button "CONNECTION", 1300, 191 65 80 25
  combo 3, 20 39 260 100, drop
  edit "", 5, 20 10 260 20, read autohs center
  button "Gestion ", 11, 191 92 80 25
  text "Ton pseudo sera :", 1205, 30 69 100 20
  edit "", 1206, 30 89 95 20, read autohs
  button "Changer", 1207, 130 89 55 20
  box , 1301, 20 59 170 60
  icon 1, 16 123 264 71,  images\icones\connection.jpg, 0, noborder center
}
on *:dialog:connection:init:*:{
  filter -fog Conf/serveurs.txt $dname 3 
  did -ra connection 5 %serv  
  did -ra connection 1206 $me 


}

on *:dialog:connection:sclick:*:{ 
  if ($did == 11) { dialog -m editserv editserv }
  if ($did == 3) { did -ra $dname 5 $did($dname,3,$did($dname,3).sel).text | set %serv $did($dname,3,$did($dname,3).sel).text   }
  if ($did == 1300) { dialog -x connection | server %serv }
  if ($did == 1207) { dialog -m nev nev 
    set %aw_nick $!     
    did -ra connection 1206 $me 
  }
}
  ----------
  dialog editserv {
    size -1 -1 280 200
    title "Gestion des Serveurs"
    button "OK",1,5 170 270 20,ok
    list 2,5 5 270 80, vsbar , sort
    edit "",3, 5 105 270 22,autohs
    button "Ajouter ce serveur",4,5 135 270 20
    button "Supprimer ce serveur ",5,5 75 270 20
  }
  on *:dialog:editserv:init:0:{ filter -fo Conf/serveurs.txt $dname 2 }
  on *:dialog:editserv:sclick:2:{ did -ra $dname 3 $did($dname,2,$did($dname,2).sel).text }
  on *:dialog:editserv:sclick:4:{
    if $did($dname,3).text != $null {
      did -a $dname 2 $did($dname,3).text
      write Conf\serveurs.txt $did($dname,3).text
      if $dialog(connection) != $null { did -a connection 3 $did($dname,3).text }
      did -r $dname 3
    }
  }
  on *:dialog:editserv:sclick:5:{
    var %sel = $did($dname,2,$did($dname,2).sel).text
    if %sel != $null {
      if $dialog(connection) != $null { did -d connection 3 $did($dname,2).sel }
      var %m = $read -s [ $+ [ %sel ] ] conf\serveurs.txt
      var %l = $readn
      write -dl $+ %l  Conf\serveurs.txt
      did -d $dname 2 $did($dname,2).sel
      did -r $dname 3
    }

  }
