anony10 Posted October 6, 2011 Share Posted October 6, 2011 Hi. I did a calculator. (okay, if u have better dont need to post) I know bug: u can write letters too, but i dont know how to fix it.So if you know, how to, pls write. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Calculator", 367, 210, 192, 124) $Input1 = GUICtrlCreateInput("", 32, 51, 121, 21) $Radio1 = GUICtrlCreateRadio("-", 160, 24, 29, 17) $Radio2 = GUICtrlCreateRadio("+", 160, 44, 29, 17) $Radio3 = GUICtrlCreateRadio("*", 160, 63, 30, 17) $Radio4 = GUICtrlCreateRadio("/", 160, 83, 28, 17) $Input2 = GUICtrlCreateInput("", 195, 50, 121, 21) $Button1 = GUICtrlCreateButton("=", 79, 108, 182, 25, 0) $Input3 = GUICtrlCreateInput("", 110, 148, 121, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $kivon = BitAnd(GUICtrlRead($Radio1),$GUI_CHECKED) $osszead = BitAnd(GUICtrlRead($Radio2),$GUI_CHECKED) $szoroz = BitAnd(GUICtrlRead($Radio3),$GUI_CHECKED) $oszt = BitAnd(GUICtrlRead($Radio4),$GUI_CHECKED) If $kivon = 1 Then kivonas() EndIf If $osszead = 1 Then osszeadas() EndIf If $szoroz = 1 Then szorzas() EndIf If $oszt = 1 Then osztas() EndIf If $kivon + $osszead + $szoroz + $oszt = 0 Then msgbox(0, "Error", "Choose from any radio buttons!") EndIf EndSwitch WEnd Func kivonas() $put1 = GuiCtrlRead ($input1) $put2 = GuiCtrlRead ($input2) $kivonasss = $put1 - $put2 GuiCtrlSetData ($Input3, $kivonasss) EndFunc Func osszeadas() $put1 = GuiCtrlRead ($input1) $put2 = GuiCtrlRead ($input2) $osszeadasss = $put1 + $put2 GuiCtrlSetData ($Input3, $osszeadasss) EndFunc Func szorzas() $put1 = GuiCtrlRead ($input1) $put2 = GuiCtrlRead ($input2) $szorzasss = $put1 * $put2 GuiCtrlSetData ($Input3, $szorzasss) EndFunc Func osztas() $put1 = GuiCtrlRead ($input1) $put2 = GuiCtrlRead ($input2) $osztasss = $put1 / $put2 GuiCtrlSetData ($Input3, $osztasss) EndFunc Link to comment Share on other sites More sharing options...
JohnOne Posted October 7, 2011 Share Posted October 7, 2011 (edited) Hi. I did a calculator. (okay, if u have better dont need to post) I know bug: u can write letters too, but i dont know how to fix it.So if you know, how to, pls write. $Input3 = GUICtrlCreateInput("", 110, 148, 121, 21,$ES_NUMBER) Edited October 7, 2011 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
anony10 Posted October 10, 2011 Author Share Posted October 10, 2011 Thx! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now