Kreatorul Posted August 30, 2006 Posted August 30, 2006 I wanted to make a simple calculator like the one included with windows but GuiCtrlRead isn't working...Here is my code...help pls expandcollapse popup#include <GuiConstants.au3> GuiCreate( "My Calculator", 220, 180 ) $pi = 3.14159265358979 $input=GuiCtrlCreateInput( "", 5, 5 ) $1=GuiCtrlCreateButton( "1", 5, 40, 25 ) $2=GuiCtrlCreateButton( "2", 35, 40, 25 ) $3=GuiCtrlCreateButton( "3", 65, 40, 25 ) $4=GuiCtrlCreateButton( "4", 5, 70, 25 ) $5=GuiCtrlCreateButton( "5", 35, 70, 25 ) $6=GuiCtrlCreateButton( "6", 65, 70, 25 ) $7=GuiCtrlCreateButton( "7", 5, 100, 25 ) $8=GuiCtrlCreateButton( "8", 35, 100, 25 ) $9=GuiCtrlCreateButton( "9", 65, 100, 25 ) $0=GuiCtrlCreateButton( "0", 5, 130, 25 ) $p=GuiCtrlCreateButton( ".", 35, 130, 25 ) $e=GuiCtrlCreateButton( "=", 65, 130, 25 ) $plus=GuiCtrlCreateButton( "+", 110, 40, 30) $minus=GuiCtrlCreateButton( "-", 143, 40, 30) $x=GuiCtrlCreateButton( "X", 176, 40, 30) $divide=GuiCtrlCreateButton( "/", 110, 70, 30) $root=GuiCtrlCreateButton( "Root", 143, 70, 30) $sqrt=GuiCtrlCreateButton( "Sqrt", 176, 70, 30) $p=GuiCtrlCreateButton( "(", 110, 100, 30) $p2=GuiCtrlCreateButton( ")", 143, 100, 30) $pi=GuiCtrlCreateButton( "Pi", 176, 100, 30) $read=GUICtrlRead($input) $ex=Execute( $read ) GuiSetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE If $msg=$1 Then GuiCtrlsetdata( $input, "1", default ) If $msg=$2 Then GuiCtrlSetData( $input, "2", default ) If $msg=$3 Then GuiCtrlSetData( $input, "3", default ) If $msg=$4 Then GuiCtrlSetData( $input, "4", default ) If $msg=$5 Then GuiCtrlSetData( $input, "5", default ) If $msg=$6 Then GuiCtrlSetData( $input, "6", default ) If $msg=$7 Then GuiCtrlSetData( $input, "7", default ) If $msg=$8 Then GuiCtrlSetData( $input, "8", default ) If $msg=$9 Then GuiCtrlSetData( $input, "9", default ) If $msg=$0 Then GuiCtrlSetData( $input, "0", default ) If $msg=$p Then GuiCtrlSetData( $input, ".", default ) If $msg=$plus Then GuiCtrlSetData( $input, "+", default ) If $msg=$minus Then GuiCtrlSetData( $input, "-", default ) If $msg=$divide Then GuiCtrlSetData( $input, "/", default ) If $msg=$x Then GuiCtrlSetData( $input, "*", default ) If $msg=$root Then GuiCtrlSetData( $input, "^", default ) If $msg=$sqrt Then GuiCtrlSetData( $input, "sqrt", default ) If $msg=$p Then GuiCtrlSetData( $input, "(", default ) If $msg=$p2 Then GuiCtrlSetData( $input, ")", default ) If $msg=$pi Then GuiCtrlSetData( $input, "3.14159265358979", default ) If $msg=$e Then MsgBox(0, "The result", $ex ) $msg = GUIGetMsg() Wend The problem is I can't get the guictrlread to read the text from the input...even without execute is the same problem...
BigDod Posted August 30, 2006 Posted August 30, 2006 expandcollapse popup#include <GuiConstants.au3> GUICreate("My Calculator", 220, 180) $pi = 3.14159265358979 $input = GUICtrlCreateInput("", 5, 5) $1 = GUICtrlCreateButton("1", 5, 40, 25) $2 = GUICtrlCreateButton("2", 35, 40, 25) $3 = GUICtrlCreateButton("3", 65, 40, 25) $4 = GUICtrlCreateButton("4", 5, 70, 25) $5 = GUICtrlCreateButton("5", 35, 70, 25) $6 = GUICtrlCreateButton("6", 65, 70, 25) $7 = GUICtrlCreateButton("7", 5, 100, 25) $8 = GUICtrlCreateButton("8", 35, 100, 25) $9 = GUICtrlCreateButton("9", 65, 100, 25) $0 = GUICtrlCreateButton("0", 5, 130, 25) $p = GUICtrlCreateButton(".", 35, 130, 25) $e = GUICtrlCreateButton("=", 65, 130, 25) $plus = GUICtrlCreateButton("+", 110, 40, 30) $minus = GUICtrlCreateButton("-", 143, 40, 30) $x = GUICtrlCreateButton("X", 176, 40, 30) $divide = GUICtrlCreateButton("/", 110, 70, 30) $root = GUICtrlCreateButton("Root", 143, 70, 30) $sqrt = GUICtrlCreateButton("Sqrt", 176, 70, 30) $p = GUICtrlCreateButton("(", 110, 100, 30) $p2 = GUICtrlCreateButton(")", 143, 100, 30) $pi = GUICtrlCreateButton("Pi", 176, 100, 30) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE If $msg = $1 Then GUICtrlSetData($input, "1", Default) If $msg = $2 Then GUICtrlSetData($input, "2", Default) If $msg = $3 Then GUICtrlSetData($input, "3", Default) If $msg = $4 Then GUICtrlSetData($input, "4", Default) If $msg = $5 Then GUICtrlSetData($input, "5", Default) If $msg = $6 Then GUICtrlSetData($input, "6", Default) If $msg = $7 Then GUICtrlSetData($input, "7", Default) If $msg = $8 Then GUICtrlSetData($input, "8", Default) If $msg = $9 Then GUICtrlSetData($input, "9", Default) If $msg = $0 Then GUICtrlSetData($input, "0", Default) If $msg = $p Then GUICtrlSetData($input, ".", Default) If $msg = $plus Then GUICtrlSetData($input, "+", Default) If $msg = $minus Then GUICtrlSetData($input, "-", Default) If $msg = $divide Then GUICtrlSetData($input, "/", Default) If $msg = $x Then GUICtrlSetData($input, "*", Default) If $msg = $root Then GUICtrlSetData($input, "^", Default) If $msg = $sqrt Then GUICtrlSetData($input, "sqrt", Default) If $msg = $p Then GUICtrlSetData($input, "(", Default) If $msg = $p2 Then GUICtrlSetData($input, ")", Default) If $msg = $pi Then GUICtrlSetData($input, "3.14159265358979", Default) If $msg = $e Then $read = GUICtrlRead($input) $ex = Execute($read) MsgBox(0, "The result", $ex) EndIf $msg = GUIGetMsg() WEnd Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
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