Rekenmachine / Calculator

By Patatje-oorlog on Oct 16, 2008

This script is a calculator with a nice dialog.

Try it now! :)

  • Belongs in remote *

©Patatje-oorlog Designs

menu channel,query,status {
  -
  $iif(($dialog(rekenmachine)),$style(2)) Rekenmachine:dialog -m rekenmachine rekenmachine
}
dialog rekenmachine {
  title "Rekenmachine / Calculator"
  size -1 -1 147 163
  option dbu
  tab "Rekenmachine / Calculator",1,1 0 146 162
  edit "",2,6 18 62 12, tab 1 disabled center
  edit "",19,68 18 10 12, tab 1 center disabled
  edit "",20,78 18 62 12, tab 1 disabled center
  edit "",21,33 32 80 12, tab 1 disabled center
  text "©Patatje-oorlog Designs" 100, 8 153 62 7,disabled
  button "+",3,117 112 25 40, tab 1 disable
  button "x",4,117 68 25 20, tab 1 disable
  button "-",5,117 90 25 20, tab 1 disable
  button "÷",6,117 46 25 20, tab 1 disable
  button "=",7,88 127 25 25, tab 1 default
  button ",",8,60 127 26 25, tab 1
  button "0",9,33 127 25 25, tab 1
  button "1",10,33 100 25 25, tab 1
  button "2",11,60 100 26 25, tab 1
  button "3",12,88 100 25 25, tab 1
  button "4",13,33 73 25 25, tab 1
  button "5",14,60 73 26 25, tab 1
  button "6",15,88 73 25 25, tab 1
  button "7",16,33 46 25 25, tab 1
  button "8",17,60 46 26 25, tab 1
  button "9",18,88 46 25 25, tab 1
  button "C",22,4 112 25 40, tab 1
  button "Ans",23,4 85 25 25, tab 1
}
on *:dialog:rekenmachine:sclick:*:{
  if ($did == 3) { did -i $dname 19 1 + }
  if ($did == 4) { did -i $dname 19 1 * }
  if ($did == 5) { did -i $dname 19 1 - }
  if ($did == 6) { did -i $dname 19 1 / }
  if ($did == 7) { did -i $dname 21 1 $calc($did(2) $did(19) $did(20)) }
  if ($did == 8) { if ($did(19) == $null) { did -i $dname 2 1 $did(2) $+ . | did -e $dname 3, 117 112 25 40 | did -e $dname 4 ,117 68 25 20 | did -e $dname 5 ,117 90 25 20 | did -e $dname 6 ,117 46 25 20 | halt } | else { did -i $dname 20 1 $did(20) $+ . | halt } }
  if ($did == 9) { if ($did(19) == $null) { did -i $dname 2 1 $did(2) $+ 0 | did -e $dname 3, 117 112 25 40 | did -e $dname 4 ,117 68 25 20 | did -e $dname 5 ,117 90 25 20 | did -e $dname 6 ,117 46 25 20 | halt } | else { did -i $dname 20 1 $did(20) $+ 0 | halt } }
  if ($did == 10) { if ($did(19) == $null) { did -i $dname 2 1 $did(2) $+ 1 | did -e $dname 3, 117 112 25 40 | did -e $dname 4 ,117 68 25 20 | did -e $dname 5 ,117 90 25 20 | did -e $dname 6 ,117 46 25 20 | halt } | else { did -i $dname 20 1 $did(20) $+ 1 | halt } }
  if ($did == 11) { if ($did(19) == $null) { did -i $dname 2 1 $did(2) $+ 2 | did -e $dname 3, 117 112 25 40 | did -e $dname 4 ,117 68 25 20 | did -e $dname 5 ,117 90 25 20 | did -e $dname 6 ,117 46 25 20 | halt } | else { did -i $dname 20 1 $did(20) $+ 2 | halt } }
  if ($did == 12) { if ($did(19) == $null) { did -i $dname 2 1 $did(2) $+ 3 | did -e $dname 3, 117 112 25 40 | did -e $dname 4 ,117 68 25 20 | did -e $dname 5 ,117 90 25 20 | did -e $dname 6 ,117 46 25 20 | halt } | else { did -i $dname 20 1 $did(20) $+ 3 | halt } }
  if ($did == 13) { if ($did(19) == $null) { did -i $dname 2 1 $did(2) $+ 4 | did -e $dname 3, 117 112 25 40 | did -e $dname 4 ,117 68 25 20 | did -e $dname 5 ,117 90 25 20 | did -e $dname 6 ,117 46 25 20 | halt } | else { did -i $dname 20 1 $did(20) $+ 4 | halt } }
  if ($did == 14) { if ($did(19) == $null) { did -i $dname 2 1 $did(2) $+ 5 | did -e $dname 3, 117 112 25 40 | did -e $dname 4 ,117 68 25 20 | did -e $dname 5 ,117 90 25 20 | did -e $dname 6 ,117 46 25 20 | halt } | else { did -i $dname 20 1 $did(20) $+ 5 | halt } }
  if ($did == 15) { if ($did(19) == $null) { did -i $dname 2 1 $did(2) $+ 6 | did -e $dname 3, 117 112 25 40 | did -e $dname 4 ,117 68 25 20 | did -e $dname 5 ,117 90 25 20 | did -e $dname 6 ,117 46 25 20 | halt } | else { did -i $dname 20 1 $did(20) $+ 6 | halt } }
  if ($did == 16) { if ($did(19) == $null) { did -i $dname 2 1 $did(2) $+ 7 | did -e $dname 3, 117 112 25 40 | did -e $dname 4 ,117 68 25 20 | did -e $dname 5 ,117 90 25 20 | did -e $dname 6 ,117 46 25 20 | halt } | else { did -i $dname 20 1 $did(20) $+ 7 | halt } }
  if ($did == 17) { if ($did(19) == $null) { did -i $dname 2 1 $did(2) $+ 8 | did -e $dname 3, 117 112 25 40 | did -e $dname 4 ,117 68 25 20 | did -e $dname 5 ,117 90 25 20 | did -e $dname 6 ,117 46 25 20 | halt } | else { did -i $dname 20 1 $did(20) $+ 8 | halt } }
  if ($did == 18) { if ($did(19) == $null) { did -i $dname 2 1 $did(2) $+ 9 | did -e $dname 3, 117 112 25 40 | did -e $dname 4 ,117 68 25 20 | did -e $dname 5 ,117 90 25 20 | did -e $dname 6 ,117 46 25 20 | halt } | else { did -i $dname 20 1 $did(20) $+ 9 | halt } }
  if ($did == 22) { did -r $dname 2 | did -r $dname 19 | did -r $dname 20 | did -r $dname 21 }
  if ($did == 23) { did -i $dname 2 1 $did(21) | did -r $dname 19 | did -r $dname 20 | did -r $dname 21 }
}

Comments

Sign in to comment.
Patatje-oorlog   -  Oct 16, 2008

The tab is because I am making a Valuta calc program which I am going to add later on :)

 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.