
-----------------------------------
jakey140
Tue Dec 19, 2006 7:44 pm

Mouse Commands
-----------------------------------
I Am trying to write a program using procedures (title, userInput, goodBye) that will display three different sized squares on the screen all in a row, each a different colour, so that when the user clicks on the squares, the program will display a message stating the size of the square (small, medium or large, and then exit when the user clicks on the word Exit, displayed in a rectangle at the lower centre of the screen... Any Ideas or starting points?

-----------------------------------
uberwalla
Tue Dec 19, 2006 7:56 pm


-----------------------------------
my idea of where to start would be the turing walkthrough. take a look at the mouse.where command. also theres always the turing reference.

-----------------------------------
jakey140
Tue Dec 19, 2006 11:05 pm


-----------------------------------
heres what I have so far.... I just need to make a few minor adjustments and I should Be set...


%Declatation Section
var finished : boolean := false
var rangex, rangey, button : int

%set screen mode and size
setscreen ("graphics")

%Program Title
procedure title
    cls
    locate (1, 14)
    put "Block Size"
end title

%Program introduction
procedure introduction
    title
    locate (3, 1)
    put "Click on any one of the  boxes"
end introduction

procedure display
    %draw three boxes on the screen
    drawfillbox (20, 20, 40, 40, green)
    drawfillbox (60, 20, 100, 60, yellow)
    drawfillbox (120, 20, 180, 80, red)
    drawbox (290, 0, 350, 30, 0)
    locatexy (300, 15)
    put "exit"
procedure display
    mousewhere (rangex, rangey, button)
    if button = 1 then
        if rangex >= 20 and rangex = 20 and rangey = 60 and rangex = 20 and rangey = 120 and rangex = 20 and rangey = 290 and rangex = 0 and rangey 