mIRC Homepage
Posted By: RusselB Dialog query re: radio buttons - 23/05/06 04:41 AM
Code:
dialog Observer {
  title "Observer"
  size -1 -1 670 230
  option pixels
  text "Account", 10, 5 5 120 16, center
  combo 20, 5 21 120 100, edit drop
  text "Route", 30, 125 5 60 16, center
  combo 40, 125 21 60 100, edit drop
  text "Name", 50, 190 5 30 16
  edit "", 60, 240 4 280 18
  text "Address", 70, 190 23 50 16
  edit "", 80, 240 22 200 18
  text "Apt", 90, 445 23 20 16
  edit "", 100, 470 22 50 18
  text "Phone", 110, 530 25 30 16
  edit "", 120, 565 24 100 18
  text "Special Directions", 130, 190 41 50 45, center
  edit "", 140, 240 40 425 45
  box "Deliveries", 150, 5 120 120 100
  radio "Daily", 160, 7 134 50 18
  radio "MP/LL", 170, 7 152 50 18
  radio "Sat. Only", 180, 57 134 65 18
  radio "Vacation", 190, 57 152 65 18
  box "Billing", 200, 123 120 63 100
  radio "PIO", 210, 125 134 40 18, group
  radio "CMP", 220, 125 152 40 18
  radio "Mthly", 230, 125 170 45 18
  radio "Bi-Wkly", 240, 125 188 55 18
  text "Start", 250, 190 85 100 15, center
  edit "", 260, 190 100 100 18
  list 270, 190 120 100 100, size
  text "Stop", 280, 295 85 100 15, center
  edit "", 290, 295 100 100 18
  list 300, 296 120 100 100, size
  text "Deliveries", 310, 400 85 50 16, center
  list 320, 400 120 50 100, size
  text "Billing", 330, 455 85 50 16, center
  list 340, 455 120 50 100, size
  text "Payment Amount && Date", 350, 510 85 155 16, center
  edit "", 360, 510 100 50 18
  edit "", 370, 565 100 100 18, disable
  list 380, 510 120 50 100, size
  list 390, 565 120 100 100, size
  button "OK", 400, 530 6 40 18, ok
  button "Cancel", 410, 575 5 40 18, cancel
  button "Save", 420, 620 5 40 18
}  


I basically have two sets of radio buttons. The first set is a bit complicated as I need the ability to have more than one button marked (maybe checkboxes would be a better way of doing them). The second set of buttons are in a group so that I can only have one of them marked at a time.
My problem lies in the fact that it doesn't matter which of the buttons I click, only the one I click is marked...including the buttons from the first set (which are not marked as a group).
An explanation (if possible) would be great.

For the first set of buttons (as I currently have them), what I'm needing is the ability to control them so that I can have the following combinations possible:
160
160 & 190
170
170 & 190
170 & 180
170, 180 & 190
180
180 & 190

As I said, I'm wondering if checkboxes might be a better way of handling those combinations, rather than radio buttons.

Currently using mIRC 6.17
Posted By: Riamus2 Re: Dialog query re: radio buttons - 23/05/06 01:25 PM
Hi RusselB. Yes, checkboxes would be your best option for what you're looking to do. And, if it's necessary to make one of the checkboxes not available when another is checked, that is easy to do as well with either an automatic uncheck/check command when you click the other one, or by enabling/disabling it when you click the other one.

As for the groups, I think that if you use groups, everything has to be grouped (so you'd need 2 groups).
Posted By: Layzie Re: Dialog query re: radio buttons - 23/05/06 02:59 PM
Check boxes would probably be ideal, but if you want to use radio buttons it can be done fairly easy as well. I posted this on another site where RusselB was looking for help so I'll copy it over to here as well.
Code:
  radio "Daily", 160, 7 134 50 18, group
  radio "MP/LL", 170, 7 152 50 18, group
  radio "Sat. Only", 180, 57 134 65 18, group 
  radio "Vacation", 190, 57 152 65 18, group
  box "Billing", 200, 123 120 63 100 
  radio "PIO", 210, 125 134 40 18, group
  radio "CMP", 220, 125 152 40 18
  radio "Mthly", 230, 125 170 45 18
  radio "Bi-Wkly", 240, 125 188 55 18


and to uncheck the radio buttons I used this

Code:
on *:dialog:observer:sclick:*: {
  if ($did == 160) {
    if (%daily == 0 || %daily == $null) { set %daily 1 | did -c $dname 160 }
    else { set %daily 0 | did -u $dname 160 }
  }
  if ($did == 170) {
    if (%mp == 0 || %mp == $null) { set %mp 1 | did -c $dname 170 }
    else { set %mp 0 | did -u $dname 170 }
  }
  if ($did == 180) {
    if (%sat == 0 || %sat == $null) { set %sat 1 | did -c $dname 180 }
    else { set %sat 0 | did -u $dname 180 }
  }
  if ($did == 190) {
    if (%vaca == 0 || %vaca == $null) { set %vaca 1 | did -c $dname 190 }
    else { set %vaca 0 | did -u $dname 190 }
  }
}
Posted By: genius_at_work Re: Dialog query re: radio buttons - 24/05/06 01:54 AM
Not that it makes a lot of difference, but you could have simply used !%var instead of (%var == 0) || (%var == $null)

-genius_at_work
Posted By: Layzie Re: Dialog query re: radio buttons - 24/05/06 02:55 AM
I always seem to forget about !%var, thanks.
© mIRC Discussion Forums