
-----------------------------------
chroncile
Wed Dec 03, 2008 7:03 pm

5 buttons with text in them
-----------------------------------
I don't know how to do this and it's due tomorrow.
This is what it says:



Create a screen using pixel graphics that displays 5 boxes, in 5 different colours.  Within each box you should have words to indicate what will appear when you click on that box.  E.g. OVAL, CIRCLE, STAR MAPLE LEAF.  Ask the user to click on a box.  Once the user clicks on a box you should clear the screen and draw a picture of the shape that they clicked on.   


I have no idea how to do that, please someone help me. Our teacher expects us to learn by our selves. How are we suppose to do that without anyone teaching us?!
:(

-----------------------------------
corriep
Wed Dec 03, 2008 7:16 pm

RE:5 buttons with text in them
-----------------------------------
Try searching Turing's Help (F10)

look up Mouse.Where, and whatdotcolor

and if you have no idea how to do the text and boxes, look up drawfillbox and Font.Draw


thats all I can give you without giving you the answer

-----------------------------------
chroncile
Wed Dec 03, 2008 7:55 pm

RE:5 buttons with text in them
-----------------------------------
This is the example the teacher gave us:

setscreen ("graphics:vga")

% VARIABLE TABLE
% x - int - the x coordinate that the user clicked on
% y - int - the y coordinate that the user clicked on
% bnum - int - the button that you select on the mouse
% bud - int - whether the button is pressed (1) or released (0)

var x, y, bnum, bud : int

% draw three boxes 
drawfillbox (100, 200, 200, 220, 1)
drawfillbox (100, 240, 200, 260, 2)
drawfillbox (100, 280, 200, 300, 14)

% prompt the user to click on a box
put "Please click the mouse inside a box"

% waits for the user to use the mouse and obtains the x,y location where the 
% mouse is clicked down
buttonwait ("down", x, y, bnum, bud)

% checks to see which box the user selected and performs the specific request
if x >= 100 and x = 200 and y = 100 and x = 240 and y = 100 and x = 280 and y  220 and x < 420 and y > 240 and y < 340 then         % click inside rectangle
            exit
        end if
    end if
end loop

cls 
drawfillmapleleaf(100,100,500,400,40)


Hope that will help, just make a few more buttons doing somewhat the same thing.

-----------------------------------
Insectoid
Thu Dec 04, 2008 12:15 pm

RE:5 buttons with text in them
-----------------------------------
Yeah, it is easier and looks nicer to make your own buttons. If you know how to make a button work, it is far easier. You know exactly what is going on with it, while with the GUI you need to look up all the functions that never work the way you want them to, and it looks like crap to boot!
