issues with hash/dialog - 25/07/05 03:31 AM
hello again,
i am trying out the hload/hsave -n switch, but am having some difficulty with some rather basic things.. with the -n switch it saves the file as data which is ok thats what i want, but the problem lies with hadd and hdel.. i've managed to fenagle the add button in my dialog for testing purposes but, i know it isn't correct. and i cant figure out how to delete a entry from the hash using this format, because when you use the -n switch while saving/loading it makes it a data file only and sets the item is a numeric refference .. like so :
* Item: 1 Value: word
* Item: 2 Value: word1
* Item: 3 value: word2
* Item: 4 Value: word3
heres what i have thus far:
if anyone can help it would be appreciated greatly!
thanks in advance
i am trying out the hload/hsave -n switch, but am having some difficulty with some rather basic things.. with the -n switch it saves the file as data which is ok thats what i want, but the problem lies with hadd and hdel.. i've managed to fenagle the add button in my dialog for testing purposes but, i know it isn't correct. and i cant figure out how to delete a entry from the hash using this format, because when you use the -n switch while saving/loading it makes it a data file only and sets the item is a numeric refference .. like so :
* Item: 1 Value: word
* Item: 2 Value: word1
* Item: 3 value: word2
* Item: 4 Value: word3
heres what i have thus far:
Code:
dialog wordlist { title "Word List" size -1 -1 106 127 option dbu combo 1, 40 15 60 92, size button "Add", 2, 4 39 30 12 button "Delete", 3, 4 66 30 12 button "Save", 4, 30 114 37 12, ok check "Enable/Disable", 5, 5 3 50 9 } on *:dialog:wordlist:*:*: { if ($devent == init) { if !$hget(words) { .hmake words 10 | .hload -n words words.dat } var %i = 1 while $hget(words,%i).data { did -a $dname 1 $v1 inc %i } if (%endisable) { did -c $dname 5 } } if ($devent == sclick) { if ($did == 2) { .hadd badwords $did(1) $did(1) | did -a $dname 1 $did(1) | did -d $dname 1 $did(1) } if ($did == 3) { .hdel words did(1).sel | did -d $dname 1 $did(1).sel } if ($did == 4) { .hsave -n words words.dat } if ($did == 5) { .set %endisable $iif($did(5).state,1,0)) } if ($did($dname,5).state == 1) { did -c $dname 5 } | else { did -u $dname 5 } } }
if anyone can help it would be appreciated greatly!
thanks in advance