CODICE
#comments-start
AutoIt Version: 3.2.12.0
Author: ~Ste.
E-mail: ste.1991@hotmail.it
http://pcrevolution.netsons.org
http://pcdesign.forumfree.net
#comments-end
#include <GUIconstants.au3>
#NoTrayIcon
; Interfaccia Grafica
GUICreate("Calcolatrice V1.0 By ~Ste.","350","300")
GUISetBkColor(0x000000)
GUICtrlCreateLabel("Calcolatrice V1.0","110","25","100","70")
GUICtrlSetColor(-1, 0x00FF00)
GUICtrlSetFont(-2,9,"","","Comic Sans MS")
$edit=GUICtrlCreateInput("0","25","80","300","20")
$editx=""
$primo=""
$secondo=""
; Menů
$menu2=GuiCtrlCreateMenu("File")
$chiudi=GUICtrlCreateMenuItem("Chiudi",$menu2)
$menu=GuiCtrlCreateMenu("?")
$info=GUICtrlCreateMenuItem("Info",$menu)
; Menů contestuale
$menu1=GuiCtrlCreateContextMenu()
$info1=GuiCtrlCreateMenuItem("Info",$menu1)
$chiudi1=GuiCtrlCreateMenuItem("Chiudi",$menu1)
; Bottoni
$1=GuiCtrlCreateButton("1","100","125","20","20")
$2=GuiCtrlCreateButton("2","125","125","20","20")
$3=GuiCtrlCreateButton("3","150","125","20","20")
$4=GuiCtrlCreateButton("4","100","150","20","20")
$5=GuiCtrlCreateButton("5","125","150","20","20")
$6=GuiCtrlCreateButton("6","150","150","20","20")
$7=GuiCtrlCreateButton("7","100","175","20","20")
$8=GuiCtrlCreateButton("8","125","175","20","20")
$9=GuiCtrlCreateButton("9","150","175","20","20")
$uguale=GuiCtrlCreateButton("=","100","200","20","20")
$0=GuiCtrlCreateButton("0","125","200","20","20")
$virgola=GuiCtrlCreateButton(".","150","200","20","20")
$piu=GuiCtrlCreateButton("+","250","138","20","20")
$meno=GuiCtrlCreateButton("-","250","163","20","20")
$x=GuiCtrlCreateButton("x","250","188","20","20")
$diviso=GuiCtrlCreateButton("/","275","138","20","20")
$potenza=GUICtrlCreateButton("^","275","163","20","20")
$ce=GuiCtrlCreateButton("CE","275","188","20","20")
; Funzioni
Func a()
If $editx="0" Then
$editx=""
EndIf
EndFunc
Func c()
GUICtrlSetState($virgola,$GUI_ENABLE)
EndFunc
; Rendo l'interfaccia grafica visibile
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
; Numeri
Case $1
a()
$editx=$editx & "1"
GUICtrlSetData($edit,$editx)
Case $2
a()
$editx=$editx & "2"
GUICtrlSetData($edit,$editx)
Case $3
a()
$editx=$editx & "3"
GUICtrlSetData($edit,$editx)
Case $4
a()
$editx=$editx & "4"
GUICtrlSetData($edit,$editx)
Case $5
a()
$editx=$editx & "5"
GUICtrlSetData($edit,$editx)
Case $6
a()
$editx=$editx & "6"
GUICtrlSetData($edit,$editx)
Case $7
a()
$editx=$editx & "7"
GUICtrlSetData($edit,$editx)
Case $8
a()
$editx=$editx & "8"
GUICtrlSetData($edit,$editx)
Case $9
a()
$editx=$editx & "9"
GUICtrlSetData($edit,$editx)
Case $0
a()
If GUICtrlRead($edit)="0" Then
$editx=""
Else
$editx=$editx & "0"
GUICtrlSetData($edit,$editx)
EndIf
Case $virgola
If $editx="" Then
$editx="0."
Else
$editx=$editx & "."
GUICtrlSetState($virgola,$GUI_DISABLE)
EndIf
GUICtrlSetData($edit,$editx)
; Menů
Case $info
MsgBox(0,"Info","Calcolatrice V1.0 By ~Ste." & @CRLF & "http://pcrevolution.netsons.org" & @CRLF & "http://pcdesign.forumfree.net" & @CRLF & "ste.1991@hotmail.it")
Case $info1
MsgBox(0,"Info","Calcolatrice V1.0 By ~Ste." & @CRLF & "http://pcrevolution.netsons.org" & @CRLF & "http://pcdesign.forumfree.net" & @CRLF & "ste.1991@hotmail.it")
Case $chiudi
Exit
Case $chiudi1
Exit
; Operazioni
Case $ce
$editx="0"
GUICtrlSetData($edit,$editx)
$editx="0"
c()
Case $piu
$primo=GUICtrlRead($edit) & "+"
$editx="0"
c()
Case $meno
$primo=GUICtrlRead($edit) & "-"
$editx="0"
c()
Case $x
$primo=GUICtrlRead($edit) & "*"
$editx="0"
c()
Case $diviso
$primo=GUICtrlRead($edit) & "/"
$editx="0"
c()
Case $potenza
$primo=GUICtrlRead($edit) & "^"
$editx="0"
c()
; Risultato
Case $uguale
If $primo="" Then
MsgBox(0,"Errore","Selezionare prima l'operatore logico")
EndIf
$secondo=GUICtrlRead($edit)
$editx=Execute($primo & $secondo)
GUICtrlSetData($edit,$editx)
$primo=""
$editx="0"
c()
EndSwitch
WEnd