mIRC Home    About    Download    Register    News    Help

Print Thread
Dialog problems (again?/still? - lol) #135788 17/11/05 05:45 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
In the initialization of my dialog I have this bit
Code:
   did -a $dname 40 Start
  did -a $dname 40 Stop
  did -a $dname 40 Payment
 

then I have this (which works)
Code:
 on *:dialog:Observer:sclick:17:{ 
  did -ca $dname 40 $iif($did($dname,17).state,Start,Stop) 
  did -ra $dname 42 $date 
  var %a = $iif($did($dname,40).seltext == $did($dname,40),$v2,$v1)
  if (%a = Start) {    var %id = 18  } 
  elseif (%a = Stop) {    var %id = 37  } 
  elseif (%a = Payment {    var %id = 39  } 
  var %time = $asctime($ctime($did($dname,42)),mmm dd yyyy)
  did -a $dname %id %time 
} 
 


The problem is, that there are times when that ON DIALOG event will change the value in 40 (which is fine), but I also want to be able to pick the Payment option, which doesn't exist once that event runs. How can I keep the Payment option (from the initialization routine) available?

I suspect as I go along, I'll encounter more problems, but this is the one that has me puzzled at the moment.

Re: Dialog problems (again?/still? - lol) #135789 17/11/05 05:57 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I'm not too sure what you mean dude, I probably have it all wrong but..

$didwm(Observer,40,Payment,0) returns the line number matching in the list box. As I said I probably have it all wrong.

-Andy

Re: Dialog problems (again?/still? - lol) #135790 17/11/05 06:20 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
40 is an editable drop down box, which, upon initialization, has 3 options available.

When I check a different location (17), then the entry for 40 automatically changes to Start or Stop (depending on that state of 17). If 40 is Start or Stop then 42 is today's date.

However, I also need to be able to change 40 to Payment (the 3rd option) at any time, and right now, if 40 is changed due to the checking of 17, the list empties except for Start (if 17 is checked) or Stop (if 17 is unchecked).

I'm not sure where you came up with your $didwm line, but I hope this clarifies the situation.

I don't think the rest of the dialog code would make any difference, but if you think it would help, say so & I'll post it.

Re: Dialog problems (again?/still? - lol) #135791 17/11/05 02:05 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Is there any other code that uses 40? Perhaps something with -r? I'm not seeing how this section can remove anything from 40. The -ca is the only thing being done to 40 in that code, and the doesn't remove stuff.


Invision Support
#Invision on irc.irchighway.net
Re: Dialog problems (again?/still? - lol) #135792 17/11/05 11:41 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
duh...RusselB smacks himself with a large trout.

Looks like I fixed the problem, and was still thinking that the problem existed. Sorry.

Re: Dialog problems (again?/still? - lol) #135793 18/11/05 06:53 PM
Joined: Oct 2005
Posts: 54
B
benjy355 Offline
Babel fish
Offline
Babel fish
B
Joined: Oct 2005
Posts: 54
Thanks everyone, it's working now grin


Chat NSN
My Server: sleepystickman.ircxpro.com
Re: Dialog problems (again?/still? - lol) #135794 19/11/05 04:11 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
After making some changes to how the information is stored (going from a text & several ini files to a hash table), I've found that one line in the following event isn't working properly & I can't figure out why. The line that isn't working is in red The item goes into the hash table, but the data does not

Code:
 on *:DIALOG:Observer:sclick:2,3: { 
  var %rte = $iif(!$did($dname,5).seltext,$did($dname,5),$did($dname,5).seltext)  
   [color:red] .hadd -m $dname Rtes $didtok($dname,5,44) [/color] 
  var %acct = $iif(!$did($dname,7).seltext,$did($dname,7),$did($dname,7).seltext)  
  .hadd -m $dname $+(%rte,.,%acct,.Name) $did($dname,9)
  .hadd -m $dname $+(%rte,.,%acct,.Address) $did($dname,11)
  .hadd -m $dname $+(%rte,.,%acct,.Apt) $did($dname,13)
  .hadd -m $dname $+(%rte,.,%acct,.Phone) $did($dname,15)
  .hadd -m $dname $+(%rte,.,%acct,.Active) $did($dname,17).state
  .hadd -m $dname $+(%rte,.,%acct,.Delivery) $did($dname,16)
  .hadd -m $dname $+(%rte,.,%acct,.Billing) $did($dname,27)
  .hadd -m $dname $+(%rte,.,%acct,.Expiry) $ctime($did($dname,22))
  var %list = 18,37,38,43,39,45
  while %list {
    var %lines = $addtok(%lines,$did($dname,$gettok(%list,1,44)).lines,44)
    var %list = $remtok(%list,$gettok(%list,1,44),1,44)
  }
  var %lines = $gettok($sorttok(%lines,44,rn),1,44)
  var %a = 1
  var %list = 18,37,38,43,39,45
  while %a <= %lines {
    var %line
    var %b = 1
    while %b <= $numtok(%list,44) {
      var %line = $puttok(%line,$did($dname,$gettok(%list,%b,44),%a),%b,44)
      inc %b
    }
    .hadd -m $dname $+(%rte,.,%acct,.data.,%a) %line
    inc %a
  }
}
 

Re: Dialog problems (again?/still? - lol) #135795 19/11/05 04:43 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Are you sure that item 5 is a list/combo/edit box? Perhaps you have the wrong type of item in place, or the wrong $did in the code.

If you have the correct item/$did, then are you sure that there is anything in that particular item? I don't know how the /hadd command will react if the data field is $null. Maybe add the -s switch to the code to display exactly what the command is doing.

-genius_at_work

Re: Dialog problems (again?/still? - lol) #135796 19/11/05 09:12 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Yes, 5 is a combo box with the edit option active.

For some reason, even after I enter something into 5 using the edit, when I click Save (3) the number in 5 isn't saved, and doesn't display using the -s switch. I'd swear that it thinks that nothing was entered.

I really didn't want to post my entire code, since most of it works fine, but this is an important part of the code, and it doesn't work.

As to how the /hadd command would work with a $null value, it would just wipe out what was previously stored, replacing it with $null

Here's my entire code. Hopefully someone will spot the problem, if it's not where I've already indicated.

Further checking has shown that I have a similar problem further down in the code. I've highlighted the specific line(s) that I think are causing the problem in red

Code:
 dialog Observer {
  title "Observer"
  size -1 -1 340 155
  option dbu
  button "Cancel", 1, 10 40 20 10, cancel
  button "OK", 2, 40 40 20 10, ok
  button Store New Info, 3, 10 60 50 10, default
  text "Rte", 4, 10 10 20 10
  combo 5, 30 10 30 10, edit drop
  text "Account", 6, 10 20 20 10
  combo 7, 30 20 60 10, edit drop
  text "Name", 8, 100 12 25 8
  edit "", 9, 130 10 50 10, autohs
  text "Address", 10, 100 22 25 8
  edit "", 11, 130 20 50 10, autohs
  text "Apt.", 12, 185 22 15 8
  edit "", 13, 205 20 20 10, autohs
  text "Phone", 14, 100 32 25 8
  edit "", 15, 130 30 50 10, autohs
  combo 16, 130 40 50 10, edit drop
  check "Active", 17, 185 32 25 8, left
  text "Billing", 19, 115 85 50 10, center
  text "Delivery", 20, 100 42 25 8
  text "Expires", 21, 185 40 50 8, center
  edit "", 22, 185 50 50 10, autohs right
  text "Start", 23, 5 85 50 10, center
  text "Stop", 24, 60 85 50 10, center
  edit "", 34, 130 60 50 10, right
  text "Balance", 28, 100 62 25 8
  text "Pay Date", 29, 225 85 50 10, center
  text "Billing", 30, 100 52 25 8
  list 18, 5 95 50 50, size extsel
  text "Delivery", 36, 170 85 50 10, center
  list 37, 60 95 50 50, size extsel
  list 38, 115 95 50 50, size extsel
  list 39, 225 95 50 50, size extsel
  text "Payment", 41, 100 72 25 8
  edit "", 42, 130 70 50 10, autohs right
  list 43, 170 95 50 50, size extsel
  text "Pay Amount", 44, 280 85 50 10, center
  combo 27, 130 50 50 10, edit drop
  list 45, 280 95 50 50, size extsel
}
on *:DIALOG:Observer:INIT:*: { 
  if !$hget($dname) { .hmake $dname 100 }
  if $exists($+($dname,.hsh)) { .hload $dname $+($dname,.hsh) }
  if !$hget($dname,Rtes) {        echo -a 8,1ALERT!!! No routes established    } 
  else {     didtok $dname 5 44 $hget($dname,Rtes)  }  
  ;  
  did -a $dname 16 Daily  
  did -a $dname 16 Sat. Only  
  did -a $dname 16 MP/LL  
  ;  
  did -a $dname 27 Office  
  did -a $dname 27 Monthly  
  did -a $dname 27 Bi-wkly  
  ;  
} 

on *:DIALOG:Observer:sclick:5: {  
  var %rte = $did($dname,5).seltext, %accts = $hfind($dname,$+(%rte,.,*,.Name),0,W)
  var %acct.name = $hfind($dname,$+(%rte,.,*,.Name),1,W)
  var %acct = $gettok(%acct.name,2,46)
  did -ra $dname 7 %acct
  var %b = 2
  while %b <= %accts {
    var %acct.name = $hfind($dname,$+(%rte,.,*,.Name),%b,W)
    var %acct = $gettok(%acct.name,2,46)
    did -a $dname 7 %acct
    inc %b
  }
} 
on *:DIALOG:Observer:sclick:7: {  
  var %acct = $did($dname,7).seltext 
  did -ra $dname 9 $hget($dname,$+(%rte,.,%acct,.Name)  
  did -ra $dname 11 $hget($dname,$+(%rte,.,%acct,.Address)  
  did -ra $dname 13 $hget($dname,$+(%rte,.,%acct,.Apt)  
  did -ra $dname 15 $hget($dname,$+(%rte,.,%acct,.Phone)  
  did $iif($hget($dname,$+(%rte,.,%acct,.Active),-c,-u) $dname 17 
  did -ra $dname 22 $asctime($hget($dname,$+(%rte,.,%acct,.Expiry),mmm dd yyyy)
  ;need to get total number of lines stored with .hadd -m $dname $+(%rte,.,%acct,.data.,%a) %line
  var %list = 18,37,38,43,39,45
  var %list.entry = 1
  while %list.entry <= $numtok(%list,44) {
    var %entry = $hfind($dname,$+(%rte,.,%acct,.data.*),%line,W)
    var %entry = $hget($dname,%entry)
    did -ra $gettok(%list,1,44) $gettok(%entry,%list.entry,44)
    inc %list.entry
  }
  var %line = 2, %lines = $hfind($dname,$+(%rte,.,%acct,.data.*),0,W)
  while %line <= %lines {
    var %list.entry = 1
    while %list.entry <= $numtok(%list,44) {
      var %entry = $hfind($dname,$+(%rte,.,%acct,.data.*),%line,W)
      var %entry = $hget($dname,%entry)
      did -a $gettok(%list,1,44) $gettok(%entry,%list.entry,44)
      inc %list.entry
    }
  }
  did -kc $dname 16 $hget($dname,$+(%rte,.,%acct,.Delivery)
  did -kc $dname 27 $hget($danem,$+(%rte,.,%acct,.Billing)
  var %balance = $calc(($ctime($did($dname,22)) - $ctime) / 1209600)
  if ($left($did($dname,16),1) == D) || ($did($dname,16).sel == 1) {
    did -ra $dname 34 $+($,$round($calc(%balance * 6.8),2))
  }
  elseif ($left($did($dname,16),1) == S) || ($did($dname,16).sel == 2) {
    did -ra $dname 34 $+($,$round($calc(%balance * 3),2))
  } 
}
on *:dialog:Observer:sclick:17:{ 
  var %id = $iif($did($dname,17).state,18,37)
  did -a $dname %id $asctime($ctime,mmm dd yyyy)
} 
on *:DIALOG:Observer:sclick:2,3: { 
  var %rte = $iif(!$did($dname,5).seltext,$did($dname,5),$did($dname,5).seltext)  
   [color:red].hadd -m $dname Rtes $didtok($dname,5,44)  [/color] 
  var %acct = $iif(!$did($dname,7).seltext,$did($dname,7),$did($dname,7).seltext)  
  .hadd -m $dname $+(%rte,.,%acct,.Name) $did($dname,9)
  .hadd -m $dname $+(%rte,.,%acct,.Address) $did($dname,11)
  .hadd -m $dname $+(%rte,.,%acct,.Apt) $did($dname,13)
  .hadd -m $dname $+(%rte,.,%acct,.Phone) $did($dname,15)
  .hadd -m $dname $+(%rte,.,%acct,.Active) $did($dname,17).state
  .hadd -m $dname $+(%rte,.,%acct,.Delivery) $did($dname,16)
  .hadd -m $dname $+(%rte,.,%acct,.Billing) $did($dname,27)
  .hadd -m $dname $+(%rte,.,%acct,.Expiry) $ctime($did($dname,22))
   [color:red] var %list = 18,37,38,43,39,45
  while %list {
    var %lines = $addtok(%lines,$did($dname,$gettok(%list,1,44)).lines,44)
    var %list = $remtok(%list,$gettok(%list,1,44),1,44)
  }
  var %lines = $gettok($sorttok(%lines,44,rn),1,44)
  var %a = 1
  var %list = 18,37,38,43,39,45
  while %a <= %lines {
    var %line
    var %b = 1
    while %b <= $numtok(%list,44) {
      var %line = $puttok(%line,$did($dname,$gettok(%list,%b,44),%a),%b,44)
      inc %b
    }
    .hadd -m $dname $+(%rte,.,%acct,.data.,%a) %line
    inc %a
  }
 [/color] }
 


Hope this helps & isn't too much information.

Re: Dialog problems (again?/still? - lol) #135797 23/11/05 08:49 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Anyone else got any ideas?...I'm stumped

Re: Dialog problems (again?/still? - lol) #135798 24/11/05 03:45 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Well, managed to get a work around for the first problem indicated, but the second one still exists Please note that there have been changes to the actual code, since it was posted, but I think the section marked is still the same.

Re: Dialog problems (again?/still? - lol) #135799 25/11/05 08:15 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Here's the current code sections with the parts that aren't working remarked. I realize that they won't work while remarked, but they don't work anyways.
Code:
 on *:DIALOG:Observer:sclick:7: {  
  set %acct $iif($did($dname,$did).seltext,$v1,$did($dname,$did))
  did -ra $dname 9 $hget($dname,$+(%rte,.,%acct,.Name))  
  did -ra $dname 11 $hget($dname,$+(%rte,.,%acct,.Address))  
  did -ra $dname 13 $hget($dname,$+(%rte,.,%acct,.Apt))
  did -ra $dname 15 $hget($dname,$+(%rte,.,%acct,.Phone))
  did $iif($hget($dname,$+(%rte,.,%acct,.Active)),-c,-u) $dname 17 
  did -ra $dname 22 $asctime($hget($dname,$+(%rte,.,%acct,.Expiry)),mmm dd yyyy)
  /*
  ;need to get total number of lines stored with .hadd -m $dname $+(%rte,.,%acct,.data.,%a) %line
  var %list = 18,37,38,43,39,45
  var %list.entry = 1
  while %list.entry <= $numtok(%list,44) {
    var %entry = $hfind($dname,$+(%rte,.,%acct,.data.*),%line,w)
    var %entry = $hget($dname,%entry)
    did -ra $dname $gettok(%list,1,44) $gettok(%entry,%list.entry,44)
    inc %list.entry
  }
  var %line = 2, %lines = $hfind($dname,$+(%rte,.,%acct,.data.*),0,w)
  while %line <= %lines {
    var %list.entry = 1
    while %list.entry <= $numtok(%list,44) {
      var %entry = $hfind($dname,$+(%rte,.,%acct,.data.*),%line,w)
      var %entry = $hget($dname,%entry)
      did -a $gettok(%list,1,44) $gettok(%entry,%list.entry,44)
      inc %list.entry
    }
  }
  did -kc $dname 16 $hget($dname,$+(%rte,.,%acct,.Delivery))
  did -kc $dname 27 $hget($danem,$+(%rte,.,%acct,.Billing))
  var %balance = $calc(($ctime($did($dname,22)) - $ctime) / 1209600)
  if ($left($did($dname,16),1) == D) || ($did($dname,16).sel == 1) {
    did -ra $dname 34 $+($,$round($calc(%balance * 6.8),2))
  }
  elseif ($left($did($dname,16),1) == S) || ($did($dname,16).sel == 2) {
    did -ra $dname 34 $+($,$round($calc(%balance * 3),2))
  } 
  */
}
on *:DIALOG:Observer:sclick:2,3: { 
  var %rte = $iif(!$did($dname,5).seltext,$did($dname,5),$did($dname,5).seltext)  
  .hadd -m $dname Rtes $iif($didtok($dname,5,44),$v1,%rte)
  var %acct = $iif(!$did($dname,7).seltext,$did($dname,7),$did($dname,7).seltext)  
  .hadd -m $dname $+(%rte,.,%acct,.Name) $did($dname,9)
  .hadd -m $dname $+(%rte,.,%acct,.Address) $did($dname,11)
  .hadd -m $dname $+(%rte,.,%acct,.Apt) $did($dname,13)
  .hadd -m $dname $+(%rte,.,%acct,.Phone) $did($dname,15)
  .hadd -m $dname $+(%rte,.,%acct,.Active) $did($dname,17).state
  .hadd -m $dname $+(%rte,.,%acct,.Delivery) $did($dname,16)
  .hadd -m $dname $+(%rte,.,%acct,.Billing) $did($dname,27)
  .hadd -m $dname $+(%rte,.,%acct,.Expiry) $ctime($did($dname,22))
  /*
  var %list = 18,37,38,43,39,45
  while %list {
    var %lines = $addtok(%lines,$did($dname,$gettok(%list,1,44)).lines,44)
    var %list = $remtok(%list,$gettok(%list,1,44),1,44)
  }
  var %lines = $gettok($sorttok(%lines,44,rn),1,44)
  var %a = 1
  var %list = 18,37,38,43,39,45
  while %a <= %lines {
    var %line
    var %b = 1
    while %b <= $numtok(%list,44) {
      var %line = $puttok(%line,$did($dname,$gettok(%list,%b,44),%a),%b,44)
      inc %b
    }
    .hadd -m $dname $+(%rte,.,%acct,.data.,%a) %line
    inc %a
  }
  */
}
 


There's part in the first code that doesn't display, inspite of the fact that the information is being saved. The sections in both codes that "match" (ie: are relevant to each other) and don't work, aren't even saving the information.