tglogo.png

Downloading File

Filename: Hash View/Edit Dialog

menu * {
  -
  Hash Tables:dialog -mv Hash Hash
}
dialog Hash {
  title "Hash Dialog"
  size -1 -1 294 171
  option dbu
  list 1, 8 11 83 107, size hsbar vsbar
  box "Hash Tables", 2, 4 3 92 149
  button "New Table", 3, 8 126 35 9
  button "Del Table", 4, 55 126 35 9
  box "Table Items", 5, 101 3 92 149
  button "New Item", 6, 105 126 35 9
  button "Del Item", 7, 152 126 35 9
  list 8, 105 11 83 107, size hsbar vsbar
  box "Item Data", 9, 198 3 92 149
  list 10, 202 11 83 107, size hsbar vsbar
  button "New Data", 11, 202 126 35 9
  button "Del Data", 12, 249 126 35 9
  button "Edit Table", 13, 31 139 35 9
  button "Edit Item", 14, 129 139 35 9
  button "Edit Data", 15, 226 139 35 9
  button "...", 16, 181 155 11 12
  edit "Input Search Term Here", 17, 4 155 135 12
  button "Search", 18, 141 155 37 12
  text "Hash Dialog Created by Zeta of SwiftIRC", 19, 194 157 99 8
  button "OK", 20, 245 153 29 8
  button "Cancel", 21, 245 161 29 8
  edit "", 22, 173 155 68 10
  edit "100", 23, 99 155 42 11, center
  text "Number of Slots (Default of 100)", 24, 20 157 79 8
  text "Table Name", 25, 142 157 29 8
  text "New Data", 27, 142 157 25 8
  edit "", 26, 70 155 68 10
  text "New Item", 28, 43 157 25 8
}
on *:DIALOG:Hash:INIT:0:{
  did -h Hash 20-28
  var %Hget $hget(0)
  var %X 1
  while (%X <= %Hget) {
    did -i Hash 1 %X $hget(%X)
    inc %X
  }
  did -z Hash 1
  did -b Hash 4,6,7,11,12,13,14,15
}
on *:DIALOG:Hash:SCLICK:1,8,10:{
  if ($did == 1) {
    if ($did(Hash, 1).sel) {
      did -h Hash 20-28
      did -v Hash 16-19
      did -r Hash 8,10
      did -e Hash 4,6,11,13
      did -b Hash 7,14,12,15
      var %Item $hget($did(Hash, 1).seltext,0).item
      var %X 1
      while (%X <= %Item) {
        did -i Hash 8 %X $hget($did(Hash, 1).seltext,%X).item
        did -i Hash 10 %X $hget($did(Hash, 1).seltext,%X).data
        inc %X
      }
      did -z Hash 8,10
    }
  }
  if ($did == 8) {
    if ($did(Hash, 8).sel) {
      did -h Hash 20-28
      did -v Hash 16-19
      did -c Hash 10 $did(Hash, 8).sel
      did -e Hash 7,14,12,15
    }
  }
  if ($did == 10) {
    if ($did(Hash, 10).sel) {
      did -h Hash 20-28
      did -v Hash 16-19
      did -c Hash 8 $did(Hash, 10).sel
      did -e Hash 7,14,12,15
    }
  }
}
;Numbers are so I wouldn't forget what $dids to put :>
on *:DIALOG:Hash:SCLICK:3,4,6,7,11-16,18,20-25:{
  if ($did == 3) {
    did -h Hash 16-19,26-28
    did -v Hash 20-25
    did -r Hash 22
    did -r Hash 23
    did -a Hash 23 100
  }
  if ($did == 4) {
    noop $input(Are you sure you would like to delete the table $+(',$did(Hash, 1).seltext,',?) $crlf $chr(160) $chr(160) $chr(160) $chr(160) There's no way of restoring it if you do.,w,Delete Warning)
    if ($! == $true) {
      hfree $did(Hash, 1).seltext 
      did -d Hash 1 $did(Hash, 1).sel
      did -b Hash 6,7,11-15
      did -r Hash 8,10
      did -z Hash 1
    }
  }
  if ($did == 6) {
    did -h Hash 16-25
    did -v Hash 20-22,26-28
  }
  if ($did == 7) {
    noop $input(Are you sure you would like to delete the item $+(',$did(Hash, 8).seltext,') from the $crlf $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) table $+(',$did(Hash, 1).seltext,'?) $crlf $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) There's no way of restoring it if you do.,w,Delete Warning)
    if ($! == $true) {
      hdel $did(Hash, 1).seltext $did(Hash, 8).seltext
      did -d Hash 8,10 $did(Hash, 8).sel
      did -b Hash 7,11-15
    }
  }
  if ($did == 11) {
    did -h Hash 16-25
    did -v Hash 20-22,26-28
  }
  if ($did == 12) {
    noop $input(Are you sure you would like to delete the data $+(',$did(Hash, 10).seltext,') from the $crlf $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) table $+(',$did(Hash, 1).seltext,'?) $crlf $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) There's no way of restoring it if you do.,w,Delete Warning)
    if ($! == $true) {
      hdel $did(Hash, 1).seltext $did(Hash, 8).seltext
      did -d Hash 8,10 $did(Hash, 8).sel
      did -b Hash 7,11-15
    }  
  }
  if ($did == 13) {
    did -h Hash 16-19,23,24,26-28
    did -v Hash 20-22,25
    did -r Hash 22
    did -a Hash 22 $did(Hash, 1).seltext
  }
  if ($did == 14) {
    did -h Hash 16-25
    did -v Hash 20-22,26-28
    did -r Hash 22,26
    did -a Hash 22 $did(Hash, 10).seltext
    did -a Hash 26 $did(Hash, 8).seltext
  }
  if ($did == 15) {
    did -h Hash 16-25
    did -v Hash 20-22,26-28
    did -r Hash 22,26
    did -a Hash 22 $did(Hash, 10).seltext
    did -a Hash 26 $did(Hash, 8).seltext
  }
  if ($did == 16) {
    did -z Hash 1
    did -b Hash 4,6,7,11,12,13,14,15
    did -r Hash 1,8,10
    did -u Hash 1 $did(Hash, 1).sel
    did -r Hash 17
    did -a Hash 17 Input Search Term Here
    var %Hget $hget(0)
    var %Z 1
    while (%Z <= %Hget) {
      did -i Hash 1 %Z $hget(%Z)
      inc %Z
    }
  }
  if ($did == 18) {
    if ($did(Hash, 17).edited) {
      did -r Hash 1,8,10
      var %X 1
      var %Y $hget(0)
      while (%X <= %Y) {
        if ($replace($did(Hash, 17).text,$chr(32),_) isin $hget(%X)) {
          did -a Hash 1 $hget(%X)
          inc %X
        }
        else {
          inc %X
        }
      }
      did -z Hash 1
    }
  }
  if ($did == 20) {
    if ($did(Hash, 27).visible == $true) {
      if (!$did(Hash, 8).sel) || (!$did(Hash, 10).sel) {
        hadd $did(Hash, 1).seltext $replace($did(Hash, 26).text,$chr(32),_) $did(Hash, 22).text
        did -i Hash 8 1 $replace($did(Hash, 26).text,$chr(32),_)
        did -i Hash 10 1 $did(Hash, 22).text
      }
      elseif ($did(Hash, 22).edited) || ($did(Hash, 26).edited) {
        if (!$did(Hash, 22).text) || (!$did(hash, 26).text) {
          noop $input(Please put an item and data!,h,Error)
        }
        else {
          hdel $did(Hash, 1).seltext $did(Hash, 8).seltext
          hadd $did(Hash, 1).seltext $replace($did(Hash, 22).text,$chr(32),_) $replace($did(Hash, 26).text,$chr(32),_)
          did -d Hash 8,10 $did(Hash, 8).sel
          did -i Hash 8 1 $replace($did(Hash, 22).text,$chr(32),_)
          did -i Hash 10 1 $replace($did(Hash, 26).text,$chr(32),_)
          did -h Hash 20-28
          did -v Hash 1-19
        }
      }
    }
    if ($did(Hash, 24).visible != $true) && ($did(Hash, 25).visible == $true) {
      if ($did(Hash, 22).edited) {
        if (!$did(Hash, 22).text) {
          noop $input(Please put a new table name!,h,Error)
        }
        else {
          hsave -b $did(Hash, 1).seltext ht.temp
          hfree $did(Hash, 1).seltext
          hmake $replace($did(Hash, 22).text,$chr(32),_)
          hload -b $replace($did(Hash, 22).text,$chr(32),_) ht.temp
          remove ht.temp
          did -d Hash 1 $did(Hash, 1).sel
          did -i Hash 1 1 $replace($did(Hash, 22).text,$chr(32),_)
          did -r Hash 8,10
          did -h Hash 20-28
          did -v Hash 1-19
        }
      }
    }
    if ($did(Hash, 24).visible == $true) && ($did(Hash, 25).visible == $true) {
      if (!$did(Hash, 22).text) || (!$did(hash, 23).text) {
        noop $input(Please put a table name and number of slots!,h,Error)
      }
      else {
        hmake $did(Hash, 22).text $did(Hash, 23).text
        did -r Hash 8,10
        did -h Hash 20-28
        did -v Hash 1-19
        did -i Hash 1 1 $replace($did(Hash, 22).text,$chr(32),_)
      }
    }
  }
  if ($did == 21) {
    did -h Hash 20-28
    did -a Hash 22,26
    did -v Hash 1-19
  }
}
 


Related Files

by Andy Carvell
by Pepsi_Man0077

Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand