mIRC Home    About    Download    Register    News    Help

Print Thread
#25507 22/05/03 10:40 PM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
When I bring up the Dialong window I want the dialog window to show what is the selected colour in the combobox
I have searched this forum for dialog combo and found a few refferences But all it does is add a extra color to the combo box

Code:
  [color:red] 
Menu channel,status {
  Color:dialog -mo dcn dcn
}
dialog dcn {
  title "Test"
  size -1 -1 77 30
  option dbu
  combo 2, 4 7 35 70, drop
  check "Check", 3, 41 9 30 10
  button "Cancel", 4, 4 19 35 10, cancel
  button "Update", 5, 40 19 35 10, ok
}
on *:dialog:dcn:*:*:{
  if ($devent == init) {
    if ($did == 0) { 
      if (%chk == 1) did -c $dname 3
      did -a $dname 2 %colour
      $dcnon
    }
  }
  if ($devent == sclick) {
    if ($did == 2) {
      if ($did(2).seltext) {
        set %colour $did(2).seltext 
        $dcnon
      } 
    }
  }
}
alias -l dcnon {
  did -a dcn 2 01 White | set %dcnon 0
  did -a dcn 2 02 Black | set %dcnon 1
  did -a dcn 2 03 Dk.Blue | set %dcnon 2
  did -a dcn 2 04 Green | set %dcnon 3
  did -a dcn 2 05 Red | set %dcnon 4
  did -a dcn 2 06 Maroon | set %dcnon 5
  did -a dcn 2 07 Purple | set %dcnon 6
  did -a dcn 2 08 Orange | set %dcnon 7
  did -a dcn 2 09 Yellow | set %dcnon 8
  did -a dcn 2 10 Lt.Green | set %dcnon 9
  did -a dcn 2 11 Teal | set %dcnon 10
  did -a dcn 2 12 Cyan | set %dcnon 11
  did -a dcn 2 13 Blue | set %dcnon 12
  did -a dcn 2 14 Pink | set %dcnon 13
  did -a dcn 2 15 Dk.Grey | set %dcnon 14
  did -a dcn 2 16 Lt.Grey | set %dcnon 15
}
 [/color]  




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
#25508 22/05/03 10:48 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
try this..

Code:
Menu channel,status {
  Color:dialog -mo dcn dcn
}
dialog dcn {
  title "Test"
  size -1 -1 77 30
  option dbu
  combo 2, 4 7 35 70, drop
  check "Check", 3, 41 9 30 10
  button "Cancel", 4, 4 19 35 10, cancel
  button "Update", 5, 40 19 35 10, ok
}
on *:dialog:dcn:*:*:{
  if ($devent == init) {
    if ($did == 0) { 
      if (%chk == 1) did -c $dname 3
      /dcnon
    }
  }
  if ($devent == sclick) {
    if ($did == 2) {
      if ($did(2).seltext) {
        set %colour $did(2).sel
        /dcnon
      } 
    }
  }
}
alias -l dcnon {
  did -a dcn 2 01 White
  did -a dcn 2 02 Black
  did -a dcn 2 03 Dk.Blue
  did -a dcn 2 04 Green
  did -a dcn 2 05 Red
  did -a dcn 2 06 Maroon
  did -a dcn 2 07 Purple
  did -a dcn 2 08 Orange
  did -a dcn 2 09 Yellow
  did -a dcn 2 10 Lt.Green
  did -a dcn 2 11 Teal
  did -a dcn 2 12 Cyan
  did -a dcn 2 13 Blue
  did -a dcn 2 14 Pink
  did -a dcn 2 15 Dk.Grey
  did -a dcn 2 16 Lt.Grey
  did -c dcn 2 %colour
}


-KingTomato
#25509 23/05/03 12:07 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Code:
dialog dcn { 
  title "Test" 
  size -1 -1 77 30 
  option dbu 
  combo 2, 4 7 35 70, drop  
  check "Check", 3, 41 9 30 10
  button "Cancel", 4, 4 19 35 10, cancel
  button "Update", 5, 40 19 35 10, ok
}
On *:dialog:dcn:*:*:{
  if $devent == init {
    didtok -a $dname 2 32 White Black Dk.Blue Green $&
      Red Maroon Purple Orange Yellow Lt.Green Teal $&
      Cyan Blue Pink Dk.Grey Lt.Grey
    did -c $dname 2 $calc(%col + 1)
  }
  elseif $devent == sclick {
    if $did == 5 {
      set %col $calc($did(2).sel - 1)
    }
  }
}

Here are some corrections:
  • /didtok is more efficient in this case, because it lets us apply a list of items (separated by the $chr(32) - space delimiter) in one (quicker) command. Notice how the $&'s are used to break the long command into three (smaller) pieces.
  • The combo box must be filled before an item is selected.
  • Since the colors range is 0-15 and the combo box range is 1-16, when selecting an item we've got to increase the variable value by one (and when saving the selected color into the variable, decrease the selection index by one).
  • The selected color will be saved upon clicking the 'Update' button.

#25510 23/05/03 03:40 AM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
Thanks KingTomato your suggestion worked. I like Online
imput on my problem.




Intelligence: It's better to ask a stupid question, then to prove it by not asking....

Link Copied to Clipboard