Hi,
i try to figure out how to make a correct Button Selection. If you hold down the Mousekey outside the Range of the Button and move the Mouse over the button it still get´s selected ( it shouldn´t ) . I can´t figure out yet how to set up a condition that says " If you click outside of a Range from a Object , it can´t be selected or the highlight Method gets not executed " . Wrong Direction ?
Thx,
D
i try to figure out how to make a correct Button Selection. If you hold down the Mousekey outside the Range of the Button and move the Mouse over the button it still get´s selected ( it shouldn´t ) . I can´t figure out yet how to set up a condition that says " If you click outside of a Range from a Object , it can´t be selected or the highlight Method gets not executed " . Wrong Direction ?
Thx,
D
Rem OOP Test Rectangle Select End Rem SuperStrict Graphics 800,600 Global x:Int Global y:Int Type button Field x_pos : Int Field y_pos : Int Field width :Int,height :Int Field color_r :Int,color_g :Int ,color_b :Int Field name : Int Method drawbutton() SetColor (color_r,color_g,color_b) DrawRect (x_pos,y_pos,width,height) End Method Method highlight() SetColor (255,255,255) DrawRect (x_pos-5,y_pos-5,110,110) DrawText "Button : " + name ,x_pos,y_pos+120 End Method Method MouseCollision() If x>= X_pos And y>= Y_pos And x <= X_pos + width And y <= Y_pos + height And MouseDown(1) highlight() End If End Method End Type ' create instances of the Class " button " Local one:button = New button Local two:button = New button Local three:button = New button one.x_pos = 20 one.y_pos = 20 one.width = 100 one.height = 100 one.color_r = 255 one.color_g = 0 one.color_b = 255 one.name = 1 two.x_pos = 200 two.y_pos = 20 two.width = 100 two.height = 100 two.color_r = 0 two.color_g = 0 two.color_b = 255 two.name = 2 three.x_pos = 400 three.y_pos = 20 three.width = 100 three.height = 100 three.color_r = 0 three.color_g = 255 three.color_b = 0 three.name = 3 While Not KeyHit(KEY_ESCAPE) Cls x=MouseX() y=MouseY() one.mouseCollision() one.drawbutton() two.mouseCollision() two.drawbutton() three.mouseCollision() three.drawbutton() Flip Wend