Hecl Builder

Easy Mobile Applications

calculadora
Download: .jad .jar
5.0/5 Average rating:

MIDP Version: 2.0
Description: Pequeña Calculadora
Last updated: Sun Dec 06 09:51:20 +0000 2009 by mmarp18

global op1 op2 op3 grupo unico
proc calcular {} {
global op1 op2 op3 grupo unico
set dato [$grupo selection get]
set data [$unico itemcget 0 -selected]
if {eq $dato "0" } { $op3 configure -text [ + [$op1 cget -text] [$op2 cget -text] ] }
if {eq $dato "1" } { $op3 configure -text [ - [$op1 cget -text] [$op2 cget -text] ] }
if {eq $dato "2" } { $op3 configure -text [ * [$op1 cget -text] [$op2 cget -text] ] }
if {eq $dato "3" } { $op3 configure -text [ / [$op1 cget -text] [$op2 cget -text] ]}
if {eq $data "1" } {
$op1 configure -text [$op3 cget -text]
$op2 configure -text ""
}
}

proc comandos {suma salir cmd formulario} {
if { eq $cmd $salir } { midlet.exit
} elseif { eq $suma $cmd } { calcular  }
}

set formulario [lcdui.form -title Calculadora]
set op1 [lcdui.textfield -label "" -type decimal]
set op2 [lcdui.textfield -label "" -type decimal]
set op3 [lcdui.textfield -label "" -type decimal]
set salir [lcdui.command -label Salir -longlabel Salir -type exit -priority 2]
set suma [lcdui.command -label Calcular -longlabel Calcular -type screen -priority 1]
set grupo [lcdui.choicegroup -type popup]

$grupo append Sumar
$grupo append Restar
$grupo append Multiplicar
$grupo append Dividir

set unico [lcdui.choicegroup -type multiple]
$unico append Continua



$formulario append $op1
$formulario append $op2
$formulario append $op3
$formulario append $grupo
$formulario append $unico

$formulario addcommand $salir
$formulario addcommand $suma
$formulario setcurrent
$formulario configure -commandaction [list comandos $suma $salir]


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/