Terrified Posted July 8, 2009 Share Posted July 8, 2009 I need help with writing some code. i want a gui 100 X 100 with a button "Go". Clicking on it will open a window with a place to enter a "number". after entering the "Number" and click next it will do the next calculate: "Number" \ 9 * 6 for example if the number is 9 so: 9 \ 9 * 6 = 6 and after i will enter the number it will give me the answer. please help me thx and sry for my bad english. Link to comment Share on other sites More sharing options...
darkmaster071 Posted July 8, 2009 Share Posted July 8, 2009 (edited) Use: GUICreate ;for creating a gui GUICtrlCreateButton ; for adding a button ;#read more about GUIs InputBox ;for user to enter the number MsgBox ;to display the calculation you made with the number Edited July 8, 2009 by darkmaster071 Link to comment Share on other sites More sharing options...
DCCD Posted July 8, 2009 Share Posted July 8, 2009 #include <GUIConstants.au3> $Form1 = GUICreate("Form1", 321, 426, 192, 124) $Input1 = GUICtrlCreateInput("", 16, 40, 281, 21) $Button1 = GUICtrlCreateButton("Button1", 208, 96, 89, 25, 0x00020000) $Label1 = GUICtrlCreateLabel("No#", 16, 16, 36, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0, "", GUICtrlRead($Input1) / 9 * 6) EndSwitch WEnd [u][font=Arial Black]M[/font]y Blog, AVSS Parts[/u][font=Arial Black]Else[/font][font=Arial Black]L[/font]ibya Linux Users Group Link to comment Share on other sites More sharing options...
BreadthFirst Posted July 8, 2009 Share Posted July 8, 2009 Do you want your calculator to have the capability of determining the appropriate order of operations?For example, if Number is 3 in the expression 2 + Number * 2, you should get 8 [2+ (Number*2)] and not 10 [(2+Number)*2].If you want to avoid this issue, you can just have your calculator work with only two numbers at a time. Link to comment Share on other sites More sharing options...
Terrified Posted July 8, 2009 Author Share Posted July 8, 2009 Do you want your calculator to have the capability of determining the appropriate order of operations? For example, if Number is 3 in the expression 2 + Number * 2, you should get 8 [2+ (Number*2)] and not 10 [(2+Number)*2]. If you want to avoid this issue, you can just have your calculator work with only two numbers at a time. how can i do that :S? Link to comment Share on other sites More sharing options...
BreadthFirst Posted July 8, 2009 Share Posted July 8, 2009 how can i do that :S?If you're new to programming it will be a pain in the behind. You will find a lot better help than I can ever give you online; google is your friend. Search for 'evaluating infix expressions' or something like that--an infix expression is the type of expression you are trying to evaluate.for example, infix expression: 3 + 2*5 + 1 postfix expression (AKA RPN): 3 2 5 * + 1 +The algorithm i've previously implemented in C++ involved converted the infix expression to a postfix expression, and then evaluated the result.If you only work with two numbers at a time like windows calculator, you can avoid all this hassle. For instance, say you type 2*3 in your calculator... you can evaluate the result next time you press the equals sign or any operation sign.2*5 + (displys result = 10) 2 + (displays result 12) 1 = (displays result 13)I hope that made sense :S Link to comment Share on other sites More sharing options...
Terrified Posted July 8, 2009 Author Share Posted July 8, 2009 #include <GUIConstants.au3> $Form1 = GUICreate("Form1", 321, 426, 192, 124) $Input1 = GUICtrlCreateInput("", 16, 40, 281, 21) $Button1 = GUICtrlCreateButton("Button1", 208, 96, 89, 25, 0x00020000) $Label1 = GUICtrlCreateLabel("No#", 16, 16, 36, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0, "", GUICtrlRead($Input1) / 9 * 6) EndSwitch WEnd thx alot! can anyone help me add a combobox with 3 option. every option will change the "second" number in the calculation. option 1 - "9" option 2 - "12" oprion 3 - "14" example: number1 \ number 2 * 6 ty very much!!! Link to comment Share on other sites More sharing options...
Terrified Posted July 8, 2009 Author Share Posted July 8, 2009 up, help plz. 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