Calculator Questions
| Author |
Message |
Wajih
|
Posted: Sat Jan 15, 2011 10:05 pm Post subject: RE:Calculator Questions |
|
|
| i did that but when i tried to press any second set of buttons, they would not work, any reasons why? |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Tony

|
Posted: Sat Jan 15, 2011 10:14 pm Post subject: RE:Calculator Questions |
|
|
| Perhaps the code flow is not where you expect it to be, or the values of mouse variables don't line up with the expected if conditionals. Trace through your program, and try to figure out exactly what's going on at every step of it. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
Wajih
|
Posted: Sat Jan 15, 2011 10:27 pm Post subject: RE:Calculator Questions |
|
|
but when i put it all in one loop, both sets of numbers work, why is that?
and do you know how to shorten string catenation generated by a string |
|
|
|
|
 |
Tony

|
Posted: Sat Jan 15, 2011 10:56 pm Post subject: Re: RE:Calculator Questions |
|
|
Wajih @ Sat Jan 15, 2011 10:27 pm wrote: but when i put it all in one loop, both sets of numbers work, why is that?
When you randomly put things in and out of code, there's a discrepancy between what you are telling the computer to do and what you understand about the things that you tell the computer to do. The difference between the two is the cause for a majority of problems with running programs.
Wajih @ Sat Jan 15, 2011 10:27 pm wrote:
and do you know how to shorten string catenation generated by a string
I don't understand this question. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
Wajih
|
Posted: Sat Jan 15, 2011 11:09 pm Post subject: RE:Calculator Questions |
|
|
but i am doing the same thing that you told me.
i put
loop
view update
draw stuff
loop
viewupdate
drawstuff
num
end loop
loop
viewupdate
drawstuff
num2
end loop
end loop
i did that. it recognized the first number and the operator, but it did not recognize the second number.
also, is there a command similar to locate? |
|
|
|
|
 |
Tony

|
Posted: Sat Jan 15, 2011 11:49 pm Post subject: RE:Calculator Questions |
|
|
I also said to read the documentation on View.Update (and the example provided there). Things you draw will not show up on screen until View.Update is called (think about the order of drawing stuff, and telling it to show up).
Also, unless there's a lot of "flashing" happening, you don't really need offscreenonly mode.
Documentation for locate might list related functions. Is there something in particular you are looking for? |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
Wajih
|
Posted: Sun Jan 16, 2011 12:07 am Post subject: RE:Calculator Questions |
|
|
exactly bro, i read it. i out the view update at the bottom of the loops AFTER it did all the drawing stuff, but then the whole screen went blank and i couldnt do anything with it.
and there is a lot of flashing going on which is why i am using offscreenonly
yes, there is.
i made up a button and a variable.
once something is multiplied, or divided, or added, or subtracted
i store it in a variable. then i "locate"
that variable onto a certain row and column.
there is a button that when it is pressed, it is supposed to clear what i have typed and set the answer back to 0.
but if try pressing that button , only the numbers that i did the operations with get deleted, not the answer. is there anything related that will cls of the answer and set the answer back to 0? |
|
|
|
|
 |
Tony

|
Posted: Sun Jan 16, 2011 12:17 am Post subject: RE:Calculator Questions |
|
|
if you use something like
| code: |
locate(row, column)
put ""
|
That will clear (draw on top of) the entire row. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
Sponsor Sponsor

|
|
 |
Wajih
|
Posted: Sun Jan 16, 2011 1:16 pm Post subject: RE:Calculator Questions |
|
|
| i got that too work but i still do not know how to do double digit operations. |
|
|
|
|
 |
Tony

|
|
|
|
 |
|
|