Computer Science Canada Help Gui. Calculator |
Author: | Evilkilla [ Sat May 29, 2004 1:31 pm ] | ||
Post subject: | Help Gui. Calculator | ||
Hey guys i need some help ok i am trying to make a calculator with GUI using functions and strreal i am trying to find out how, too...... use the = button to output, as in say i use my variable adder to hold the strings while i use strreal and put it in num1 somehow using a if statement or...... i am not sure, any pointers would be nice thanks. to output say 1 + 1 = 2 thanks _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
Author: | guruguru [ Sat May 29, 2004 3:43 pm ] |
Post subject: | |
You have to make 'adder' a integer, nd then when a button is clicked, you add that button's number value to 'adder'. When you press equal, you display adder. Then you have to include divide and such. In your button procedures, you should if statements to see if divide or whatever has been pressed, and then change adder accordingly by the next number pressed. |
Author: | Evilkilla [ Sat May 29, 2004 3:58 pm ] | ||
Post subject: | |||
huh.... but i have to use Adder with is a string to store the buttons pressed and the numbers and then convert it with strreal to a real number.. i am stuck at there... i dunno what to do next help plz thanks like below to store the numbers pressed.
|
Author: | guruguru [ Sat May 29, 2004 6:33 pm ] |
Post subject: | |
But thats my point... you should make adder an integer. Its easier to do everything. You can do all calculations at any point in the program, not just at the end where you convert it. |
Author: | Evilkilla [ Sat May 29, 2004 6:59 pm ] |
Post subject: | |
could you gimme an example i dun understand |
Author: | guruguru [ Sat May 29, 2004 7:08 pm ] | ||
Post subject: | |||
|
Author: | Evilkilla [ Sat May 29, 2004 7:51 pm ] |
Post subject: | |
i tried, it says must be boolean type ![]() p.s your end procedures are wrong end b1 for b4 |
Author: | guruguru [ Sat May 29, 2004 9:28 pm ] |
Post subject: | |
Sorry, the error is my mistake. In the if statements, any that say ":=" replace with "=". Quote: p.s your end procedures are wrong end b1 for b4
I cannot for the life of me understand what you just said. |
Author: | Evilkilla [ Sat May 29, 2004 10:02 pm ] |
Post subject: | |
ahhh sorry Quote: proc b4
put "4 " .. if currentNum := 1 then num1 := 4 elsif currentNum := 2 then num2 := 4 end if currentPress += 1 end b1 proc b2 put "2 " .. if currentNum := 1 then num1 := 2 elsif currentNum := 2 then num2 := 2 end if currentPress += 1 end b1 see procedure b2, end is b1 same with b4 |
Author: | Evilkilla [ Sat May 29, 2004 10:09 pm ] |
Post subject: | |
also Currentnum and CurrentPress is not declared what should it be... and what is it used for.............program doesn't run, |
Author: | guruguru [ Sat May 29, 2004 10:22 pm ] | ||
Post subject: | |||
I made a slight modification so it works. I made a operation variable that tells what operation to perform. Kinda self-explanitory. If you have questions please ask.
PS: You can add in rest of buttons and procs. |
Author: | Evilkilla [ Sat May 29, 2004 11:29 pm ] |
Post subject: | |
Thanks man you helped me out alot!, i will post finished product for you guys when i am done and with you for credit!! |
Author: | guruguru [ Sun May 30, 2004 12:05 am ] |
Post subject: | |
Sweet ![]() |
Author: | Evilkilla [ Wed Jun 02, 2004 8:29 pm ] |
Post subject: | |
ahhhh i need help again, each person who helps with legit info gets 5 bits from me, first come first serve. Guru imma give you 5. So first 2 gets the other bits. Well heres the problem now.. I can't use more than one operator. and numbers. |