jaytea commented on a Page, calculator dialog  -  Sep 11, 2011

not that i would recommend it, but here's a funny little method just fyi:

dialog calc {
  ...
  button "/" 47, 25 14 15 10
  button "*" 42, 40 14 15 10
  button "-" 45, 55 14 15 10
  button "7" 55, 10 25 15 10 
  button "8" 56, 25 25 15 10
  button "9" 57, 40 25 15 10
  button "+" 43, 55 25 15 21
  button "4" 52, 10 36 15 10
  button "5" 53, 25 36 15 10
  button "6" 54, 40 36 15 10
  button "1" 49, 10 47 15 10
  button "2" 50, 25 47 15 10
  button "3" 51, 40 47 15 10
  button "0" 48, 10 58 30 10
  button "." 46, 40 58 15 10
  button "k" 107, 10 69 15 10
  button "m" 109, 25 69 15 10
  button "b" 98, 40 69 15 10
  ...
}

on *:dialog:calc:sclick:42-109:{ did -a calc 19 $chr($did) }

edit: haha, just realized the buttons' text are precisely what you want to add to the editbox. a range check + $did($did).text would also suffice, and would be much more sensible than renumbering your controls:

on *:dialog:calc:sclick:3-12,14-18,22-24:{ did -a calc 19 $did($did) }
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.