Hecl Builder

Easy Mobile Applications

Dreiecke
Download: .jad .jar
4.0/5 Average rating:

MIDP Version: 2.0
Description: Patchwork calculations: enter short side of an isosceles, right-angled triangle (as often used in patchworking) and seam allowance. Result shown is side length of square to cut along diagonal to get triangles _including_ seam allowance.
Last updated: Tue Apr 14 08:59:38 +0000 2009 by clange

proc triangleAreaWithAllowance {shortSide allowance} {
  set tmp [+ [* 2 $allowance] $shortSide [/ [* 2 $allowance] [sqrt 2]] ]
  return [/ [* $tmp $tmp] 2]
}

proc tr2sq {shortSide allowance nr} {
  set triangleArea [triangleAreaWithAllowance $shortSide $allowance]
  
  return [sqrt [* $triangleArea $nr]]
}

proc eventHandler {shortField allowField cmd form} {
  set shortSide [$shortField cget -text]
  set allowance [$allowField cget -text]
  set result [tr2sq $shortSide $allowance 2]
  
  # set {pre post} [split $result .]
  set splitResult [split $result .]
  set pre [lindex $splitResult 0]
  set post [lindex $splitResult 1]
  set post [strrange $post 0 1]

  [lcdui.alert -title "Kantenlaenge Quadrat" -text "$pre.$post" -timeout forever -type info] setcurrent
}

set triangleForm [lcdui.form -title "Dreiecke"]
set shortSide [lcdui.textfield \
		  -label "Kurze Seite:" \
	          -type decimal \
	          -text "8"]
set allowance [lcdui.textfield \
		  -label "Nahtzugabe:" \
	          -type decimal \
	          -text "0.75"]
set calcCmd [lcdui.command -label "Calc!" \
		  -longlabel "Berechnung ausfuehren!" \
		  -type screen -priority 1]
		 
$triangleForm append $shortSide
$triangleForm append $allowance
$triangleForm addcommand $calcCmd
$triangleForm configure -commandaction [list eventHandler $shortSide $allowance]
$triangleForm setcurrent


Note: If you have trouble with the applets on this site, you might try upgrading your Jave Runtime Environment, in order to get the "Next-Generation Java Plug-In", available for download here: http://download.java.net/jdk6/