
-----------------------------------
Kanaki
Mon Jan 25, 2010 8:43 pm

Button help please!
-----------------------------------
What is it you are trying to achieve?
I'm trying to finish my project which is due tomorrow.  It is a program that can disarm or arm(with a help button) an alarm system. 


What is the problem you are having?
The buttons are not working when I go and press it and I don't even know if the program is correct.


Describe what you have tried to solve this problem
I tried the positioning of the loop and it still did not work, it did work once but then after it didn't work at all.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Here's the code.  And I have the pictures if you want it.




import GUI in "%oot/lib/GUI"
View.Set ("graphics:800,600")


var p : int := Pic.FileNew("enterpassword.jpg")
Pic.Draw (p, 0, 0, 0)

%The button's location.
const armX1 := 521
const armY1 := 4
const armX2 := 648
const armY2 := 194
const disarmX1 := 148
const disarmY1 := 11
const disarmX2 := 297
const disarmY2 := 190
const helpX1 := 681
const helpY1 := 290
const helpX2 := 774
const helpY2 := 392

var check : boolean := false %checks if alarm is secure or not.
var value : int

var x,y,button : int

loop
const password:=1
var typed:int
var font:=Font.New("Times:30")
get typed
%So it doesn't lag or doesn't go over what is pressed.
GUI.Refresh 
var a : int := Pic.FileNew ("FSE menu copy.jpg")
Pic.Draw (a, 0, 0, 0)

drawbox(armX1,armY1,armX2,armY2,black)
drawbox(disarmX1,disarmY1,disarmX2,disarmY2,black)
drawbox(helpX1,helpY1,helpX2,helpY2,black)

if typed=password then
    mousewhere (x, y, button)
    %Once the armed button is pressed, the alarm will set off if the door is opened.
    if armX1 