mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#131632 02/10/05 04:12 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
How do I get the information for a drop down box to display in the box?

I have a list of numbers that I want in a drop down box, then when one is selected, it'll bring up other information

I'm trying to learn about dialogs, but the tutorials haven't been of much help in this regard.
I have Dialog Studio, which I'm using to figure out just how I want things laid out on the screen, but I can't figure out how to get the information to display in the appropriate areas.

What I'm looking for, in the long run, is something like this
1) A level is selected
2) Based on the level selected, a list of people that have that access level is displayed
3) Based on the nick selected, the following information will be displayed: Name, Address, Phone #, DOB, Gender, e-mail address

If I can get that much resolved, I should be able to figure out how to add more information if I want to

Right now the information is being stored in an ini file using similar to: /writeini -n $+(%level,.ini) %nick Name %name

#131633 02/10/05 06:55 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
can you post the dialog table so i can insert the script into it please??

because the information you request is something too

Code:
on *:DIALOG:DIALOGNAME:SCLICK:ID: {
if ($did($dname,ID).seltext) { did -ra $dname IDOFLISTBOXHERE $readini(bleh bleh)
}


now of course if theres more then one value in the ini file we have to just insert multiple lines without the list box...

so if im understanding what your requesting exactly is that when you click a nick in your Drop Down menu, you want the INFO of this nick to appear in the dialog Listbox correct like

NAME: name of person
DOB: dob...

etc.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#131634 02/10/05 07:15 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Basically, yes. Each person has a Level, so I want one drop box with the levels listed, then another drop box for the names for that level.
Here's the dialog code that I've come up with. I don't know if this may need to be changed for what I actually want.
This shows a basic line up for the information that I want displayed.
I also want to be able to change the information displayed, or be able to add new entries.
Code:
 dialog Observer {
  title Observer
  size -1 -1 440 70
  option dbu
  button "OK", 14, 0 30 20 10, default ok
  text "Level", 15, 0 10 20 8
  combo 16, 20 10 30 8, edit drop
  button "Cancel", 1, 0 50 20 10, cancel
  text "Nick", 2, 60 10 20 8
  combo 3, 80 10 60 48, size edit drop
  text "Name", 4, 150 10 25 8
  edit "", 5, 180 10 50 10
  text "Address", 6, 150 20 25 8
  edit "", 7, 180 20 50 10
  text "Apt.", 8, 240 20 20 8
  edit "", 9, 260 20 20 8
  text "Phone", 10, 150 40 25 8
  edit "", 11, 180 40 50 10
  text "Province/State", 12, 240 30 45 8
  edit "", 13, 280 30 20 8
  text "E-mail", 17, 150 50 25 8
  text "City", 18, 150 30 25 8
  edit "", 19, 180 30 50 10
  edit "", 20, 180 50 50 10
  text "DOB", 21, 240 50 25 8
  edit "", 22, 260 50 40 8
}
 

#131635 02/10/05 09:34 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Well russell since you help alot around mirc.com i mostly coded everything now we can use hash tables to store the info or you can leave as... please insert this code before editing it then when it runs, then edit after. DO NOT use own entries... how this script works
Select Level in drop down trust me theres 4 levels on init. smile
once level is selected type name of person in nick dropdown, then add all the info in (user info) section, then click my new button "store info"

once done close dialog and restart and select the level you put your info in it should be there and then if you drop down nicklist youll see his/her info...

now its not neccasary to restart the dialog you can enter as much info as you want then reselect the Level to store info... smile well im sure youll get the hang of it your not a newb rusell LOL

Code:
dialog Observer {
  title Observer
  size -1 -1 320 0
  option dbu
  button "OK", 14, 5 30 20 10, default ok
  text "Level", 15, 5 10 20 8
  combo 16, 20 10 30 8, edit drop
  button "Cancel", 1, 5 50 20 10, cancel
  text "Nick", 2, 60 10 20 8
  combo 3, 80 10 60 48, size edit drop
  text "Name", 4, 150 10 25 8
  edit "", 5, 180 10 50 10, autohs
  text "Address", 6, 150 20 25 8
  edit "", 7, 180 20 50 10, autohs
  text "Apt.", 8, 240 20 20 8
  edit "", 9, 260 20 20 8, autohs
  text "Phone", 10, 150 40 25 8
  edit "", 11, 180 40 50 10, autohs
  text "Province/State", 12, 240 30 45 8
  edit "", 13, 280 30 20 8, autohs
  text "E-mail", 17, 150 50 25 8
  text "City", 18, 150 30 25 8
  edit "", 19, 180 30 50 10, autohs
  edit "", 20, 180 50 50 10, autohs
  text "DOB", 21, 240 50 25 8
  edit "", 22, 260 50 40 8, autohs left
  button Store New Info, 23, 50 50 50 10, flat

  box User Info, 1000, 145 2 160 62
}

on *:DIALOG:Observer:INIT:*: {
  %resize = on
  if (%resize == on) { .timer 1 0 /diag.size Observer -1 -1 320 70 }
  did -a $dname 16 Level 5
  did -a $dname 16 Level 10
  did -a $dname 16 Level 15
  did -a $dname 16 Level 100
}

on *:DIALOG:Observer:sclick:16: {
  if ($did($dname,16).seltext == Level 5) {
    if ($exists(level5.txt) == $true) {
      var %obs.store = 1, %obs.calc = $lines(level5.txt)
      while (%obs.store <= %obs.calc) {
        did -r $dname 3
        timer 1 0 /did -a $dname 3 $read(level5.txt,%obs.store)
        inc %obs.store
      }
    }
    elseif ($exists(level5.txt) == $false) {
      echo -a 8,1ALERT!!! You have not created a level 5 access doc yet.
    }
  }
  if ($did($dname,16).seltext == Level 10) {
    if ($exists(level10.txt) == $true) {
      var %obs.store = 1, %obs.calc = $lines(level10.txt)
      while (%obs.store <= %obs.calc) {
        did -r $dname 3 
        /timer 1 0 /did -a $dname 3 $read(level10.txt,%obs.store)
        inc %obs.store
      }
    }
    elseif ($exists(level10.txt) == $false) {
      echo -a 8,1ALERT!!!! You have not created a level 10 access doc yet.
    }
  }
  if ($did($dname,16).seltext == Level 15) {
    if ($exists(level15.txt) == $true) {
      var %obs.store = 1, %obs.calc = $lines(level15.txt)
      while (%obs.store <= %obs.calc) {
        did -r $dname 3
        timer 1 0 /did -a $dname 3 $read(level15.txt,%obs.store)
        inc %obs.store
      }
    }
    elseif ($exists(level15.txt) == $false) { 
      echo -a 8,1ALERT!!! You have not created a level 15 access doc yet. 
    }
  }
  if ($did($dname,16).seltext == Level 100) {
    if ($exists(level100.txt) == $true) {
      var %obs.store = 1, %obs.calc = $lines(level100.txt)
      while (%obs.store <= %obs.calc) {
        did -r $dname 3
        timer 1 0 /did -a $dname 3 $read(level100.txt,%obs.store)
        inc %obs.store
      }
    }
    elseif ($exists(level100.txt) == $false) {
      echo -a 8,1ALERT!!! You have not created a level 100 access doc yet.
    }
  }
}

on *:DIALOG:Observer:sclick:3: {
  %name.sel = $did($dname,3).seltext
  did -ra $dname 5 %name.sel
  did -ra $dname 7 $readini(nnames.ini,n,%name.sel,Address)
  did -ra $dname 9 $readini(nnames.ini,n,%name.sel,Apt)
  did -ra $dname 11 $readini(nnames.ini,n,%name.sel,Phone)
  did -ra $dname 13 $readini(nnames.ini,n,%name.sel,prov/state)
  did -ra $dname 19 $readini(nnames.ini,n,%name.sel,City)
  did -ra $dname 20 $readini(nnames.ini,n,%name.sel,email)
  did -ra $dname 22 $readini(nnames.ini,n,%name.sel,DOB)
}

on *:DIALOG:Observer:sclick:23: {
  if ($did($dname,16).seltext == Level 5) {
    write level5.txt $did($dname,3).text
    timer 1 1 writeini nnames.ini $did($dname,3).text Address $did($dname,7).text
    timer 1 2 writeini nnames.ini $did($dname,3).text Apt $did($dname,9).text
    timer 1 3 writeini nnames.ini $did($dname,3).text Phone $did($dname,11).text
    timer 1 4 writeini nnames.ini $did($dname,3).text Prov/State $did($dname,13).text
    timer 1 5 writeini nnames.ini $did($dname,3).text City $did($dname,19).text
    timer 1 6 writeini nnames.ini $did($dname,3).text Email $did($dname,20).text
    timer 1 7 writeini nnames.ini $did($dname,3).text DOB $did($dname,22).text
  }
  if ($did($dname,16).seltext == Level 10) {
    write level10.txt $did($dname,3).text
    timer 1 1 writeini nnames.ini $did($dname,3).text Address $did($dname,7).text
    timer 1 2 writeini nnames.ini $did($dname,3).text Apt $did($dname,9).text
    timer 1 3 writeini nnames.ini $did($dname,3).text Phone $did($dname,11).text
    timer 1 4 writeini nnames.ini $did($dname,3).text Prov/State $did($dname,13).text
    timer 1 5 writeini nnames.ini $did($dname,3).text City $did($dname,19).text
    timer 1 6 writeini nnames.ini $did($dname,3).text Email $did($dname,20).text
    timer 1 7 writeini nnames.ini $did($dname,3).text DOB $did($dname,22).text
  }
  if ($did($dname,16).seltext == Level 15) {
    write level15.txt $did($dname,3).text
    timer 1 1 writeini nnames.ini $did($dname,3).text Address $did($dname,7).text
    timer 1 2 writeini nnames.ini $did($dname,3).text Apt $did($dname,9).text
    timer 1 3 writeini nnames.ini $did($dname,3).text Phone $did($dname,11).text
    timer 1 4 writeini nnames.ini $did($dname,3).text Prov/State $did($dname,13).text
    timer 1 5 writeini nnames.ini $did($dname,3).text City $did($dname,19).text
    timer 1 6 writeini nnames.ini $did($dname,3).text Email $did($dname,20).text
    timer 1 7 writeini nnames.ini $did($dname,3).text DOB $did($dname,22).text
  }
  if ($did($dname,16).seltext == Level 100) {
    write level100.txt $did($dname,3).text
    timer 1 1 writeini nnames.ini $did($dname,3).text Address $did($dname,7).text
    timer 1 2 writeini nnames.ini $did($dname,3).text Apt $did($dname,9).text
    timer 1 3 writeini nnames.ini $did($dname,3).text Phone $did($dname,11).text
    timer 1 4 writeini nnames.ini $did($dname,3).text Prov/State $did($dname,13).text
    timer 1 5 writeini nnames.ini $did($dname,3).text City $did($dname,19).text
    timer 1 6 writeini nnames.ini $did($dname,3).text Email $did($dname,20).text
    timer 1 7 writeini nnames.ini $did($dname,3).text DOB $did($dname,22).text
  }
}

alias diag.size {
  set %sn 1
  while (%sn <= $5) {
    .dialog -srb $1 $2 $3 $4 %sn
    inc %sn
  }
}


Enjoy


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#131636 02/10/05 10:29 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks a lot. That code works great. As you noted I do help out when & where I can, however, this is my first experimentation with dialogs, as dialogs require one on one interaction, and most of the coding that I've done has been for bots, where the interaction is done remotely, rather than directly.

#131637 02/10/05 10:43 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
yeah I love Dialogs so much its like creating a new program laugh

if you find a bug just tell me, im sure i looked the code over twice before i released it

Enjoy


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#131638 03/10/05 05: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
After reviewing the code, and making several modifications, most of which worked with no problems, but there's one part that's got me stumped as to why it's not working.
I have marked the area that is giving me trouble with a remarked statement.
Here's the code as it currently stands, and a couple of examples regarding the format of the ini files where the information is stored
Code:
 alias obs {
  dialog -m Observer Observer
}
dialog Observer {
  title "Observer"
  size -1 -1 330 80
  option dbu
  button "Cancel", 1, 5 50 20 10, cancel
  button "OK", 2, 5 30 20 10, default ok
  button Store New Info, 3, 50 50 50 10, flat
  text "Rte", 4, 5 10 20 10
  combo 5, 20 10 30 10, edit drop
  text "Account", 6, 60 10 20 10
  combo 7, 80 10 60 10, size edit drop
  text "Name", 8, 150 10 25 10
  edit "", 9, 180 10 50 10, autohs
  text "Address", 10, 150 20 25 10
  edit "", 11, 180 20 50 10, autohs
  text "Apt.", 12, 240 20 20 10
  edit "", 13, 260 20 20 10, autohs
  text "Phone", 14, 150 40 25 10
  edit "", 15, 180 40 50 10, autohs
  combo 16, 180 30 50 10, edit drop
  check "Active", 17, 240 30 30 10, left
  combo 18, 180 50 50 10, edit drop
  text "Billing", 19, 150 50 20 10
  text "Delivery", 20, 150 30 25 10
  text "Expires", 21, 240 50 25 10
  edit "", 22, 260 50 40 8, autohs
  box User Info, 1000, 145 2 160 72
  text "Start", 23, 150 60 25 8
  text "Stop", 24, 240 60 25 8
  combo 25, 180 60 50 10, sort size edit drop
  combo 26, 260 60 40 10, sort size edit drop
}

on *:DIALOG:Observer:INIT:*: {
  %resize = on
  if (%resize == on) { .timer 1 0 /diag.size Observer -1 -1 320 70 }
  if !$lines(Observer.txt) {
    echo -a 8,1ALERT!!! No routes established
  }
  else {
    var %a = 1
    while %a <= $lines(Observer.txt) {
      did -a $dname 5 $read(Observer.txt,t,%a)
      inc %a
    }
  }
  ;
  did -a $dname 16 Daily
  did -a $dname 16 Sat. Only
  did -a $dname 16 MP/LL
  ;
  did -a $dname 18 Office
  did -a $dname 18 Monthly
  did -a $dname 18 Bi-wkly
  ;
  did -a $dname 25 $adate
}

on *:DIALOG:Observer:sclick:5: {
  var %rte = $did($dname,5).seltext
  if !$exists($+(%rte,.ini)) {
    echo -a 8,1ALERT!!!4,0 You have no entries for Rte %rte
  }
  else {
    var %obs.store = 1, %obs.calc = $ini($+(%rte,.ini),0)
    ;this section isn't loading the appropriate information to the drop box in the dialog
    while (%obs.store <= %obs.calc) {
      did -a $dname 7 $ini($+(%rte,.ini),%obs.store)
      inc %obs.store
    }
  }
}
on *:DIALOG:Observer:sclick:7: {
  var %file = $+($did($dname,5).seltext,.ini), %acct = $did($dname,7).seltext
  did -ra $dname 9 $readini(%file,n,%acct,Name)
  did -ra $dname 11 $readini(%file,n,%acct,Address)
  did -ra $dname 13 $readini(%file,n,%acct,Apt)
  did -ra $dname 15 $readini(%file,n,%acct,Phone)
  did -ra $dname 17 $readini(%file,n,%acct,Active)
  did -ra $dname 18 $readini(%file,n,%acct,Billing)
  did -ra $dname 16 $readini(%file,n,%acct,Deliveries)
  did -ra $dname 22 $readini(%file,n,%acct,Expiry)
}
on *:DIALOG:Observer:sclick:2: {
  var %file = $iif(!$did($dname,5).seltext,$did($dname,5),$did($dname,5).seltext)
  .write -s Observer.txt %file
  var %file = $+(%file,.ini)
  var %acct = $iif(!$did($dname,7).seltext,$did($dname,7),$did($dname,7).seltext)
  .writeini -n %file %acct Name $did($dname,9)
  .writeini -n %file %acct Address $did($dname,11)
  if ($did($dname,13)) {    .writeini -n %file %acct Apt $did($dname,13)  }
  if ($did($dname,15)) {  .writeini -n %file %acct Phone $did($dname,15) }
  .writeini -n %file %acct Active $did($dname,17).state
  .writeini -n %file %acct Billing $did($dname,18).seltext
  .writeini -n %file %acct Deliveries $did($dname,16).seltext
  .writeini -n %file %acct Expiry $iif($did($dname,22),$did($dname,22),$adate)
  if ($did($dname,17).edited == $true) {    did -a $dname $iif($did($dname,17).state,25,26) $adate  }
  .writeini -n %file %acct Start $didtok($dname,25,32)
  if $didtok($dname,26,32) {
    .writeini -n %file %acct Stop $didtok($dname,26,32)
  }
  echo -a Route $left(%file,-4) updated
}


on *:DIALOG:Observer:sclick:3: {
  var %file = $iif(!$did($dname,5).seltext,$did($dname,5),$did($dname,5).seltext)
  .write -s Observer.txt %file
  var %file = $+(%file,.ini)
  var %acct = $iif(!$did($dname,7).seltext,$did($dname,7),$did($dname,7).seltext)
  .writeini -n %file %acct Name $did($dname,9)
  .writeini -n %file %acct Address $did($dname,11)
  if ($did($dname,13)) {    .writeini -n %file %acct Apt $did($dname,13)  }
  if ($did($dname,15)) {  .writeini -n %file %acct Phone $did($dname,15) }
  .writeini -n %file %acct Active $did($dname,17).state
  .writeini -n %file %acct Billing $did($dname,18).seltext
  .writeini -n %file %acct Deliveries $did($dname,16).seltext
  .writeini -n %file %acct Expiry $iif($did($dname,22),$did($dname,22),$adate)
  if ($did($dname,17).edited == $true) {    did -a $dname $iif($did($dname,17).state,25,26) $adate  }
  .writeini -n %file %acct Start $didtok($dname,25,32)
  if $didtok($dname,26,32) {
    .writeini -n %file %acct Stop $didtok($dname,26,32)
  }
  echo -a Route $left(%file,-4) updated
}

alias diag.size {
  set %sn 1
  while (%sn <= $5) {
    .dialog -srb $1 $2 $3 $4 %sn
    inc %sn
  }
}
 

Code:
 [49077744]
Name=Dunn, Gladys
Address=135 Queen
Active=1
Billing=Office
Deliveries=Daily
Expiry=10/21/2005
Start=10/03/2005
[49071530]
Name=Odell, E
Address=150 Queen
Apt=102
Active=1
Billing=Office
Deliveries=Daily
Expiry=10/2/2005
Start=10/03/2005
 


I realize that there's quite a difference between what I had originally asked for help with, and what I'm asking for help with now. That's due to the fact that the two implementations are for different purposes.

#131639 03/10/05 08:23 AM
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
Dont know if its still needed or not, but the following is much more efficient for adding than the original which duplicated a lot of code. And im not sure what reason there was for using timers, so just removed them.

on *:DIALOG:Observer:sclick:23: {
write $+(level,$$gettok($did($dname,16).seltext,2,32),.txt) $did($dname,3).text
writeini -n nnames.ini $did($dname,3).text Address $did($dname,7).text
writeini -n nnames.ini $did($dname,3).text Apt $did($dname,9).text
writeini -n nnames.ini $did($dname,3).text Phone $did($dname,11).text
writeini -n nnames.ini $did($dname,3).text Prov/State $did($dname,13).text
writeini -n nnames.ini $did($dname,3).text City $did($dname,19).text
writeini -n nnames.ini $did($dname,3).text Email $did($dname,20).text
writeini -n nnames.ini $did($dname,3).text DOB $did($dname,22).text
; Call alias to 'refresh' dialog here
}


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
#131640 03/10/05 05:45 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
the timer was because the info wasnt refreshing all over there was a conflict..

and dude your assigned the wrong did command you send it to a edit box rather then drop down.. drop down = COMBO box

Code:
  else {
    var %obs.store = 1, %obs.calc = $ini($+(%rte,.ini),0)
    ;this section isn't loading the appropriate information to the drop box in the dialog
    while (%obs.store <= %obs.calc) {
      did -a $dname 7 $ini($+(%rte,.ini),%obs.store)
[color:green]; this is being assigned to edit id 7 while only combo's i see in your table is 3 and 16[/color]
      inc %obs.store
    }


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#131641 03/10/05 07:18 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
RusselB's does use 7 for a combo ID.


Invision Support
#Invision on irc.irchighway.net
#131642 03/10/05 07:36 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Well i found one thing so far... your not able to create a .txt file named observer because your causing a -s switch (scan) so remove the write -s observer.txt $file just remove the -s so it can store Route... on file so accessable all time smile

more to come... still troubleshooting sorry im not completly understanding the large code completly but ill get around it.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#131643 03/10/05 08:50 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
well rus the ONLY prob i beleive why nothing was going into your DID 7 is BECAUSE look at your table.. combo ID, x y w h, size edit drop

right?? that was yours

DO NOT use size in a combo without justify the combo drop size so therefore keep it as is..

combo ID, x y w h, edit drop

LMAO this was giving me a headache till i decided to manually type from command line /did -a Observer 7 TEXT and it didnt go through then i looked at the table and saw it there.. smile well here is the whole dialog mate

note DO NOT EDIT size of dialog itself for scroll effect to take place note i put a 0 in the height of it because the alias itself at the bottom while automatically justify size

Code:
alias obs {
  dialog -m Observer Observer
}
dialog Observer {
  title "Observer"
  size -1 -1 330 0
  option dbu
  button "Cancel", 1, 5 50 20 10, cancel
  button "OK", 2, 5 30 20 10, default ok
  button Store New Info, 3, 50 50 50 10, flat
  text "Rte", 4, 5 10 20 10
  combo 5, 20 10 30 10, edit drop
  text "Account", 6, 60 10 20 10
  combo 7, 80 10 60 10, sort edit drop
  text "Name", 8, 150 10 25 10
  edit "", 9, 180 10 50 10, autohs
  text "Address", 10, 150 20 25 10
  edit "", 11, 180 20 50 10, autohs
  text "Apt.", 12, 240 20 20 10
  edit "", 13, 260 20 20 10, autohs
  text "Phone", 14, 150 40 25 10
  edit "", 15, 180 40 50 10, autohs
  combo 16, 180 30 50 10, edit drop
  check "Active", 17, 240 30 30 10, left
  combo 18, 180 50 50 10, edit drop
  text "Billing", 19, 150 50 20 10
  text "Delivery", 20, 150 30 25 10
  text "Expires", 21, 240 50 25 10
  edit "", 22, 260 50 40 8, autohs
  box User Info, 1000, 145 2 160 72
  text "Start", 23, 150 60 25 8
  text "Stop", 24, 240 60 25 8
  combo 25, 180 60 50 10, sort size edit drop
  combo 26, 260 60 40 10, sort size edit drop
}

on *:DIALOG:Observer:INIT:*: {
  %resize = on
  if (%resize == on) { .timer 1 0 /diag.size Observer -1 -1 320 78 }
  if !$lines(Observer.txt) {
    echo -a 8,1ALERT!!! No routes established
  }
  else {
    var %a = 1
    while (%a <= $lines(Observer.txt)) {
      did -a $dname 5 $read(Observer.txt,%a)
      inc %a
    }
  }
  ;
  did -a $dname 16 Daily
  did -a $dname 16 Sat. Only
  did -a $dname 16 MP/LL
  ;
  did -a $dname 18 Office
  did -a $dname 18 Monthly
  did -a $dname 18 Bi-wkly
  ;
  did -a $dname 25 $adate
}

on *:DIALOG:Observer:sclick:5: {
  var %rte = $did($dname,5).seltext
  if !$exists($+(%rte,.ini)) {
    echo -a 8,1ALERT!!!4,1 You have no entries for Rte %rte
  }
  else {
    var %obs.store = 1, %obs.calc = $ini($+(%rte,.ini),0)
    ;this section isn't loading the appropriate information to the drop box in the dialog
    while (%obs.store <= %obs.calc) {
      did -a $dname 7 $ini($+(%rte,.ini),%obs.store)
      inc %obs.store
    }
  }
}


on *:DIALOG:Observer:sclick:7: {
  var %file = $+($did($dname,5).seltext,.ini), %acct = $did($dname,7).seltext
  did -ra $dname 9 $readini(%file,n,%acct,Name)
  did -ra $dname 11 $readini(%file,n,%acct,Address)
  did -ra $dname 13 $readini(%file,n,%acct,Apt)
  did -ra $dname 15 $readini(%file,n,%acct,Phone)
  did -ra $dname 17 $readini(%file,n,%acct,Active)
  did -ra $dname 18 $readini(%file,n,%acct,Billing)
  did -ra $dname 16 $readini(%file,n,%acct,Deliveries)
  did -ra $dname 22 $readini(%file,n,%acct,Expiry)
}
on *:DIALOG:Observer:sclick:2: {
  var %file = $iif(!$did($dname,5).seltext,$did($dname,5),$did($dname,5).seltext)
  .write Observer.txt %file
  var %file = $+(%file,.ini)
  var %acct = $iif(!$did($dname,7).seltext,$did($dname,7),$did($dname,7).seltext)
  .writeini -n %file %acct Name $did($dname,9)
  .writeini -n %file %acct Address $did($dname,11)
  if ($did($dname,13)) {    .writeini -n %file %acct Apt $did($dname,13)  }
  if ($did($dname,15)) {  .writeini -n %file %acct Phone $did($dname,15) }
  .writeini -n %file %acct Active $did($dname,17).state
  .writeini -n %file %acct Billing $did($dname,18).seltext
  .writeini -n %file %acct Deliveries $did($dname,16).seltext
  .writeini -n %file %acct Expiry $iif($did($dname,22),$did($dname,22),$adate)
  if ($did($dname,17).edited == $true) {    did -a $dname $iif($did($dname,17).state,25,26) $adate  }
  .writeini -n %file %acct Start $didtok($dname,25,32)
  if $didtok($dname,26,32) {
    .writeini -n %file %acct Stop $didtok($dname,26,32)
  }
  echo -a Route $left(%file,-4) updated
}


on *:DIALOG:Observer:sclick:3: {
  var %file = $iif(!$did($dname,5).seltext,$did($dname,5),$did($dname,5).seltext)
  .write Observer.txt %file
  .write Account.txt $did($dname,7).text
  var %file = $+(%file,.ini)
  var %acct = $iif(!$did($dname,7).seltext,$did($dname,7),$did($dname,7).seltext)
  .writeini -n %file %acct Name $did($dname,9)
  .writeini -n %file %acct Address $did($dname,11)
  if ($did($dname,13)) {    .writeini -n %file %acct Apt $did($dname,13)  }
  if ($did($dname,15)) {  .writeini -n %file %acct Phone $did($dname,15) }
  .writeini -n %file %acct Active $did($dname,17).state
  .writeini -n %file %acct Billing $did($dname,18).seltext
  .writeini -n %file %acct Deliveries $did($dname,16).seltext
  .writeini -n %file %acct Expiry $iif($did($dname,22),$did($dname,22),$adate)
  if ($did($dname,17).edited == $true) {    did -a $dname $iif($did($dname,17).state,25,26) $adate  }
  .writeini -n %file %acct Start $didtok($dname,25,32)
  if $didtok($dname,26,32) {
    .writeini -n %file %acct Stop $didtok($dname,26,32)
  }
  echo -a Route $left(%file,-4) updated
}

alias diag.size {
  set %sn 1
  while (%sn <= $5) {
    .dialog -srb $1 $2 $3 $4 %sn
    inc %sn
  }
}


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#131644 04/10/05 12:14 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks for your help. I don't understand why it works with your code, but not what I had, however, it does.
Next problem I've encountered is in this section
Code:
 on *:DIALOG:Observer:sclick:7: {  
  var %file = $+($did($dname,5).seltext,.ini), %acct = $did($dname,7).seltext  
  did -ra $dname 9 $readini(%file,n,%acct,Name)  
  did -ra $dname 11 $readini(%file,n,%acct,Address)  
  did -ra $dname 13 $readini(%file,n,%acct,Apt)  
  did -ra $dname 15 $readini(%file,n,%acct,Phone)  
  did $iif($readini(%file,n,%acct,Active),-c,-u) $dname 17
  did -ra $dname 18 $readini(%file,n,%acct,Billing)  
  did -ra $dname 16 $readini(%file,n,%acct,Deliveries)  
  did -ra $dname 22 $readini(%file,n,%acct,Expiry)
}
 

I had to change the /did for item 17 to get it to work correctly.
However, the information read from the ini file isn't being displayed for items 16 & 18. It does display if I select that item, but I'd like that to show automatically, and still be able to change it by selecting the item, if necessary.
For example if Billing is Daily, it should show Daily in the display, and allow me to be able to change it to Sat Only or MP/LL

I also edited the other combo boxes so that they all use edit drop...removed size, and sort, where applicable.

I also just noticed that when the information is written to the text files, currently there are two text files being written to, Observer.txt and Account.txt, the information is written to each file, even if the information already exists. This causes the drop down box for the Rte # to have multiple entries for each route. I don't understand why you have Account.txt being written, as I can't find any reference to that file anywhere else in the code.

Last edited by RusselB; 04/10/05 01:45 AM.
#131645 04/10/05 03:38 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Oops delete write account.txt that was my bad... i was just testing lol
its not neccessary

btw the only 2 changes you had to do in your original code is remove Size from the combo 7, xywh, drop edit section

and remove -s from write -s observer.txt .......... thats it


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#131646 04/10/05 03:53 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Quote:


Code:
 on *:DIALOG:Observer:sclick:7: {  
  var %file = $+($did($dname,5).seltext,.ini), %acct = $did($dname,7).seltext  
  did -ra $dname 9 $readini(%file,n,%acct,Name)  
  did -ra $dname 11 $readini(%file,n,%acct,Address)  
  did -ra $dname 13 $readini(%file,n,%acct,Apt)  
  did -ra $dname 15 $readini(%file,n,%acct,Phone)  
  did $iif($readini(%file,n,%acct,Active),-c,-u) $dname 17
  did -r[color:red]c[/color]a $dname 18 $readini(%file,n,%acct,Billing)  
  did -r[color:red]c[/color]a $dname 16 $readini(%file,n,%acct,Deliveries)  
  did -ra $dname 22 $readini(%file,n,%acct,Expiry)
}
 




just remember TV RCA brand if you got a combo box and want info to pop right away just do -RCA :P

btw i see more size in your combo boxes remove then what i mean is

combo ID, X Y W H, drop edit... you keep putting size there remove that


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#131647 04/10/05 04:02 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
without the -s (and yes, I realized afterwards that I was forgetting to include the search term), every time I add a new entry, the route number gets written to the Observer.txt file

I've got a total of nearly 400 entries over 13 routes, and I don't see why I would have to have the route numbers written to the text file 400 times, when it could be just once per route (a total of 13 entries)

Originally I had /write -s Observer.txt %file
which should've read /write -s $+ %file Observer.txt %file
so that if the value of %file was already in Observer.txt it would just be written over
instead it seems like you're saying I have to use /write Observer.txt %file
which, as I said earlier, would make a text file with about 400 entries in it, when there's only 13 different values

Regarding the other changes you mentioned, I've either already changed them, or will do so soon.

I've already removed the size parameter, for lack of a better term, from the combo boxes.

I was doing some entries, then checked them, and noticed that the entry for Start keeps going to 12/31/1969, no matter what I enter for the date at that location. At the moment it's a small matter, but one that should get fixed up. If it helps, I was using a default date of 09/01/2005

#131648 04/10/05 04:57 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Quote:
without the -s (and yes, I realized afterwards that I was forgetting to include the search term), every time I add a new entry, the route number gets written to the Observer.txt file

I've got a total of nearly 400 entries over 13 routes, and I don't see why I would have to have the route numbers written to the text file 400 times, when it could be just once per route (a total of 13 entries)

Originally I had /write -s Observer.txt %file
which should've read /write -s $+ %file Observer.txt %file
so that if the value of %file was already in Observer.txt it would just be written over
instead it seems like you're saying I have to use /write Observer.txt %file
which, as I said earlier, would make a text file with about 400 entries in it, when there's only 13 different values

Regarding the other changes you mentioned, I've either already changed them, or will do so soon.

I've already removed the size parameter, for lack of a better term, from the combo boxes.

I was doing some entries, then checked them, and noticed that the entry for Start keeps going to 12/31/1965, no matter what I enter for the date at that location. At the moment it's a small matter, but one that should get fixed up. If it helps, I was using a default date of 09/01/2005


im not sure what your reffering too because your INIT is (partial code)

did -a $dname 16 MP/LL
;
did -a $dname 18 Office
did -a $dname 18 Monthly
did -a $dname 18 Bi-wkly
;
did -ca $dname 25 $adate
}

which $adate = Actual date (today right now OCT 4th 2005) so it should prompt adate (IF BY ANYCHANCE YOU STILL GET SAME ERROR CHECK YOUR PC CLOCK I BET YOU ITS THE YEAR YOUR SAYING)

sorry for caps but i wanted to make that stand out

please explain just a lil more thanks

also ill point out something since you said your kinda a beginner on dialog coding... I noticed you said if ($did($dname,17).edited << now 17 = a checkbox and edited wouldnt help so within the sorta code you got following ... it well anyone it should be

if ($did($dname,17).state == 1) << this means if checkbox = checked

if ($did($dname,17).state == 0) << this means if checkbox = unchecked

Code:
*******************your code***************************8
if ($did($dname,17).edited == $true) {    did -a $dname $iif($did($dname,17).state,25,26) $adate  }
  .writeini -n %file %acct Start $didtok($dname,25,32)
  if $didtok($dname,26,32) {
    .writeini -n %file %acct Stop $didtok($dname,26,32)
  }
  echo -a Route $left(%file,-4) updated
}


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#131649 04/10/05 08:39 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Found the problem...stupid mistake on my part.

As to $did($dname,17).edited, I want the current date to go into one of two locations depending on if the box is checked or not, but only if the check box was changed.

It might not be the greatest for coding, but it works

#131650 04/10/05 12:05 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Coolio is all good now?


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#131651 04/10/05 01:17 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
/write -s should work just fine as long as you're using the correct format (including the $+ %file like you mentioned).


Invision Support
#Invision on irc.irchighway.net
Page 1 of 2 1 2

Link Copied to Clipboard