All pastes #57076 Raw Edit

inc. dialogs

public text v1 · immutable
#57076 ·published 2006-05-19 12:34 UTC
rendered paste body
Alias circles {
  /dialog -ma cir cir
}
dialog cir {
  title "Circles"
  size -1 -1 112 60
  option dbu
  list 1, 2 10 50 28, size
  text "Solve For...", 2, 2 3 27 7
  text "r=", 3, 59 10 5 8
  edit "", 4, 68 9 15 10, autohs
  edit "", 5, 59 28 50 10, autohs read
  button "Calculate", 6, 33 43 37 12, default flat
}
on *:DIALOG:cir:init:*:{
  /did -a $dname 1 Diameter
  /did -a $dname 1 Circumference
  /did -a $dname 1 Area
}
on *:DIALOG:cir:sclick:6:{
  if ($did($dname,1).seltext == $null) { halt }
  if ($did($dname,1).seltext == Diameter) {
    /did -r $dname 5
    if ($did($dname,4).text != $null) && ($did($dname,4).text isnum 1-) {
      /did -a $dname 5 D= $+ $bytes($calc( $did($dname,4).text * 2 ),db)
    }
    else { /did -a $dname 5 No Radius Given }
  }

  elseif ($did($dname,1).seltext == Circumference) {
    /did -r $dname 5
    if ($did($dname,4).text != $null) && ($did($dname,4).text isnum 1-) {
      /did -a $dname 5 C= $+ $bytes($round($calc( ( 2 * $pi ) * $did($dname,4).text ),2),db)
    }
    else { /did -a $dname 5 No Radius Given }
  }

  elseif ($did($dname,1).seltext == Area) {
    /did -r $dname 5
    if ($did($dname,4).text != $null) && ($did($dname,4).text isnum 1-) {
      /did -a $dname 5 A= $+ $bytes($round($calc( ( $did($dname,4).text ^ 2 ) * $pi ),2),db)
    }
    else /did -a $dname 5 No Radius Given
  }
}
alias boyles {
  dialog -ms boyl boyl
}
dialog boyl {
  title "Boyle's Law"
  size -1 -1 101 65
  option dbu
  edit "P1 * V1 = P2 * V2", 4, 50 5 47 10, read
  edit "", 5, 5 37 20 10
  edit "", 6, 29 37 20 10
  edit "", 7, 78 37 20 10
  edit "", 8, 54 37 20 10
  text "=", 9, 50 38 3 8
  text "*", 10, 75 40 2 8
  text "*", 11, 26 40 2 8
  text "P1", 12, 6 31 7 6
  text "V1", 13, 30 31 7 6
  text "P2", 14, 55 31 7 6
  text "V2", 15, 79 31 7 6
  edit "", 16, 27 50 30 10, read autohs
  button "Calculate", 17, 61 50 37 12, default flat
  text "Solution:", 18, 4 52 21 8
  list 1, 2 8 45 20, size
  text "Solve For", 2, 2 1 25 7
}
on *:DIALOG:boyl:sclick:1:{
  if ($did($dname,1).seltext == Pressure) {
    did -e $dname 7
    did -b $dname 8
  }
  if ($did($dname,1).seltext == volume) {
    did -e $dname 8
    did -b $dname 7
  }
}
on *:DIALOG:boyl:init:*:{
  /did -a $dname 1 Pressure
  /did -a $dname 1 Volume
}
on *:DIALOG:boyl:sclick:17:{
  /did -r $dname 16
  if ($did($dname,1).seltext == $null) { /did -a $dname 16 No solution selected }
  elseif ($did($dname,1).seltext == Pressure) {
    echo -a pressure
    did -b $dname 8 
    if ($did($dname,7).text == $null) { /did -a $dname 16 insufficient Information | halt }
  }
  elseif ($did($dname,1).seltext == Volume) { echo -a volume
    did -b $dname 7
  if ($did($dname,8).text == $null) { /did -a $dname 16 insufficient Information | halt } }
}