Re: +Help!

new topic     » goto parent     » topic index » view thread      » older message » newer message

> Data de tramesa:   Fri, 08 May 1998 15:03:36 -0500 (CDT)
> De  :              Lewis Townsend <keroltarr at HOTMAIL.COM>
> Assumpte:          Re: +Help!
> A:                 Multiple recipients of list EUPHORIA
 <EUPHORIA at MIAMIU.ACS.MUOHIO.EDU>
> Enviar resposta a: Euphoria Programming for MS-DOS
 <EUPHORIA at MIAMIU.ACS.MUOHIO.EDU>

> Greetings,
>
> >      Can someone explain me with accuracy and simplicity how can i
> >      make 'clickeable' by the mouse a certain area of a text-
> >      mode screen?
> >      Imagine that i have the text 'Quit' at position (10,10).I've
> >      tried to figure out Jiri Babor's textmenu.e but it's quite
> >      complex for me!
> >
> >see ya!:)
> >       - Luis -
>
> I've never tried it on a text screen before but this should work.
> Ok, you know the get_mouse command? well you use that like this I think:
>
> -- untested code --
>
> include mouse.e  -- of course
> sequence qbutton,mouse
> qbutton = "Quit"
> position(10,10)
> puts(1,qbutton)
> mouse = get_mouse()
> if mouse[2]>10 then
>     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
>
> -- end untested code --
>
> I hope this isn't too complicated and in fact there is
> probably a much simpler way to do it, I just haven't
> figured it out yet:  you might use find() more and compare()
> but I'm not sure.  I waited to see if anyone else would
> answer your question before I did.
>
> I didn't test this code but it should be close to working,
> I just wish it didn't take so many statements.
>
> Good luck,
>
> Lewis Townsend
> |      ____ _     _     _ _    __
> |\    | __/ ||   / |   // || / __ \
> | \   ||_   ||  //||  //  || ||__\|
> |  \  | _|  || // || //   || \___ \
> | | \ ||__  ||//  ||//    || |\__||
> | |\ \|___\ |_/   |_/     || \____/
> | | \ \      _____    ________
> | |  \ \     | __ \  | __  __ |
> | |   \ \    ||__||  |/  ||  \|
> | |    \ \   | __ /      ||
> | |_____\ \  ||  \\      ||
> |__________\ ||  ||      ||
> Keroltarr at hotmail.com
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com


Hi Lewis,
 I tested your code and it doesn't works.There's a type-check failure
 that i think that i've remove it changing 'mouse' to a object.

  Please,check out the following code! ;)

-- tested code --
include mouse.e  -- of course
with trace
-- trace(1)
sequence qbutton
object mouse
integer clicked
mouse_events(LEFT_DOWN + LEFT_UP + RIGHT_DOWN)
----> we dont need the mouse to report the MOVE event i suppose!
qbutton = "Quit"
position(10,10)
puts(1,qbutton)
while 1 do
mouse = get_mouse()
--if mouse != -1 then ----> error!
---------------------------------------------------------------------
if sequence( mouse ) then  -----> if not,mouse = -1 would cause error!
--    if sequence( mouse ) then
        -- mouse press?
        clicked = and_bits( mouse[1], LEFT_DOWN ) ----->???????
        -- some one knows the use of and_bits() in here????????
        -- adjust
        mouse[2] = mouse[2]/8 --------> to scale the coordinates!
        mouse[3] = mouse[3]/8 --------> Thanks David Cuny,I missed
                                     -- this error!:)
 if mouse[2]>10 and mouse[2]<15 and mouse[3] = 10 then -->it should
                                                      --  be the
                                                      -- coordinates
                                                      -- of the button
     puts(1,"quiting...")
     exit
 else
 position(1,1)
 puts(1,"you must hit Quit!")
 end if
    else
        -- no click
        clicked = 0
--    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} ---> to make sure that will be a sequence
end while


-- Thanks to David Cuny,Lewis Townsend and everybody!

   - Luis -

>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu