Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

mouseMoveCaptured with right mouse button - bug?

For general discussion related FlowStone

Re: mouseMoveCaptured with right mouse button - bug?

Postby tulamide » Sun Nov 16, 2014 11:47 am

billv wrote:
Code: Select all
def mouseLDown x,y
   @mouse=0
    captureMouse if @mouse = 0   
end
def mouseRDown x,y
   @mouse=1
    captureMouse if @mouse = 1   
end
def mouseMoveCaptured x,y 
       if @mouse==0 then
          output 0,x
   elsif @mouse==1 then
          output 1,y
      end
end
def mouseLUp x,y
     releaseMouse if @mouse = 0
end
def mouseRUp x,y
     releaseMouse if @mouse = 1
end

Don't quite get this. The 'if' statement doesn't check for a value but assigns either 0 or 1 (e.g. @mouse = 1, instead of @mouse == 1). But then you don't need an 'if'. The code line before would be sufficient.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: mouseMoveCaptured with right mouse button - bug?

Postby billv » Sun Nov 16, 2014 12:06 pm

billv wrote:(e.g. @mouse = 1, instead of @mouse == 1)

yeh...that' parts not needed it seems...and wrong anyway...
Still works fine without it. Thanks..
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: mouseMoveCaptured with right mouse button - bug?

Postby tulamide » Sun Nov 16, 2014 12:22 pm

billv wrote:yeh...I'm not sure why @mouse = 1 works here...still has me thinking a bit.....

That's because "if var = value" isn't an error of any kind. In ruby, var will be assigned the value and then checked if it's true, which is is of course ("var = value" will always be true). It doesn't harm in this case, since you intended to set the var to the value, but

Code: Select all
@mouse = 0
captureMouse


is sufficient. And the last two should work with a double equal. Unless there's a severe issue with Ruby in Flowstone...

EDIT: Just saw your edited answer. Wrote this before, so I'll leave it, for others to read^^
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: mouseMoveCaptured with right mouse button - bug?

Postby billv » Sun Nov 16, 2014 12:58 pm

Thanks tulamide
I"m finding the release part is no good as well.....
So I've ended up with this...
Code: Select all
def mouseLDown x,y
    @mouse=0
    captureMouse 
end

def mouseRDown x,y
    @mouse=1
    captureMouse   
end
def mouseMoveCaptured x,y 
       if @mouse==0 then
          output 0,x
    elsif @mouse==1 then
          output 1,y
      end
end
def mouseLUp x,y
    releaseMouse
    @mouse = 0
end
def mouseRUp x,y
    releaseMouse
    @mouse = 1
end
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Previous

Return to General

Who is online

Users browsing this forum: Google [Bot] and 46 guests

cron