Re: Sequence/Atom prob

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

On Sat, 2 Dec 2000, Paul Kerslake wrote:

> Hi,
>
>     I've been having some problems with get_mouse() and if-then loops. It
>     seems that at the begining I need the variable assinged to get_mouse() to be an
>     atom, then to change to a sequence. Here's the prog:
>
> object event
> event=-1
>
> procedure mouseaction()
>     while event=-1 do
>         event=get_mouse()
>         if sequence(event) then
>             if and_bits(event[1], 2)  then   --2's left down
>             display_image({300,420},ufire2[2])
>             end if
>         end if
>     end while
> end procedure
>
> mouseaction()
>
>    Can you help me out? Also, what exactly does and_bits do here? I had to get
>    it from the HTML documentation to get the mouse action to work----I understand
>    the rest, just not this.
>
> Thanks
> Thomas
>

Note:
sequence s
s = {1,2,3,-1}
? s = -1

This displays:
{0,0,0,1}

What you need to do is this:
while integer(event) do

instead of:
while event = -1 do

You could also use:
while equal(event, -1) do

But that's slightly less efficient (I think).

Jeff

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

Search



Quick Links

User menu

Not signed in.

Misc Menu