1. Re: +Help about mouse!
> Data de tramesa: Wed, 13 May 1998 16:24:25 -0700
> De : David Cuny <dcuny at DSS.CA.GOV>
> Assumpte: Re: +Help!
> A: Multiple recipients of list EUPHORIA <EUPHORIA at
> MIAMIU.ACS.M
UOHIO.EDU>
> Enviar resposta a: Euphoria Programming for MS-DOS <EUPHORIA at
> MIAMIU.ACS.MUOHIO
.EDU>
Hi all!
I've make some modifications to Lewis Townsend's code and it seems
that works!Please,check the code!
Thanks everybody for your help ;)
-- untested code --
include mouse.e -- of course
include graphics.e
with trace
--trace(1)
sequence qbutton
object mouse
integer clicked
mouse_events(LEFT_DOWN + LEFT_UP + RIGHT_DOWN)
qbutton = "[ Quit ]"
position(10,10)
text_color(BLACK)
bk_color(WHITE)
puts(1,qbutton)
bk_color(BLACK)
text_color(WHITE)
while 1 do
mouse = get_mouse()
--if mouse != -1 then
---------------------------------------------------------------------
-------
if sequence( mouse ) then
-- if sequence( mouse ) then
-- mouse press?
clicked = and_bits( mouse[1], LEFT_DOWN )
-- adjust
mouse[2] = mouse[2]/8 --------> to scale the coordinates
mouse[3] = mouse[3]/8
-- if mouse[2]>10 - 1 and mouse[2]<15 - 1 and mouse[3] = 10 - 1 then
if mouse[2] = 10 - 1 or mouse[2] > 10 - 1
and mouse[2] < 10 - 1 + length( qbutton )
or mouse[2] = 10 - 1 + length( qbutton ) - 1
and mouse[3] = 10 - 1 then
position(1,1)
puts(1,"< quiting... > Yeah! it seems that works :)")
exit
else
position(1,1)
puts(1,"you must hit Quit!\n")
printf(1, "\nMouse position:\n---------------\nY = %d \nX = %d
", {mouse[2], mouse[3]})
end if
else
-- no click
clicked = 0
-- end if
-- if clicked...
-- if clicked then
-- clear variables
-- clicked_window = 0
-- clicked_button = 0
-- end if
-- if mouse[3]>{10} then
-- if mouse[2]<10+length(qbutton) then
-- ^
--the [2] and [3] might need to be
--switched on these two lines to work
-- v
-- if mouse[3]<10 then
-- if find(LEFT_UP,mouse[1]) then
-- run_quit_routine() --you get the idea?
-- end if
-- end if
-- end if
--end if
end if
mouse = {0,0,0}
end while
-- end untested code --
>
How it is supposed to work with a menu bar?
Thanks to David Cuny for his complete reference manual about the use
of the mouse...it's a real tutorial!
Regards,
Luis