Computer Science Canada

button isn't working?

Author:  iii [ Sat Jan 16, 2010 11:01 pm ]
Post subject:  button isn't working?

What is it you are trying to achieve?
Creating clickable text buttons.


What is the problem you are having?
For the "the law and more" button, when I click it, it doesn't work. For all the other text buttons, they all work.


Describe what you have tried to solve this problem
Changing mousewhere to buttonwait doesn't work.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:


body procedure lessons
    Pic.Draw (car, 0, 360, picUnderMerge)
    Font.Draw ("history", 100, 370, fontCalibri, black)
    Pic.Draw (car, 0, 260, picUnderMerge)
    Font.Draw ("driving", 100, 270, fontCalibri, black)
    Pic.Draw (car, 0, 160, picUnderMerge)
    Font.Draw ("the law and more", 100, 170, fontCalibri, black)
    View.Update
        loop
            mousewhere (x, y, button)
            if button = 1 then
                if (x > 0 and x < maxx) and (y > 360 and y < 400) then
                    cls
                    heading
                    View.Update
                elsif (x > 0 and x < maxx) and (y > 260 and y < 300) then
                    cls
                    heading
                    View.Update
                elsif (x > 0 and x < maxx) and (y > 160 and y > 200) then
                    cls
                    heading
                    View.Update
                end if
            else
                activatedlessons
            end if
        end loop
end lessons




Please specify what version of Turing you are using
4.05

Author:  TerranceN [ Sat Jan 16, 2010 11:19 pm ]
Post subject:  RE:button isn\'t working?

On this statement:

elsif (x > 0 and x < maxx) and (y > 160 and y > 200) then

should it not be y < 200?

Author:  TheGuardian001 [ Sat Jan 16, 2010 11:20 pm ]
Post subject:  Re: button isn't working?

you appear to have misused the <> signs:

code:

(y > 160 and y > 200)


Edit: Ninja'd

Author:  iii [ Sat Jan 16, 2010 11:58 pm ]
Post subject:  Re: button isn't working?

Oh! Oops. Embarassed Thank you so much!


: