[fxruby-users] FXGLObject canDrag

Lyle Johnson lyle at knology.net
Mon Feb 20 09:58:20 EST 2006


On Feb 20, 2006, at 1:57 AM, Björn Bergqvist wrote:

> I've noticed that when I have a FXGLObject in a GLViewer it's possible
> to drag it (the FXGLObject). How do I prevent the FXGLObject from
> being draggable?

You need to override the object's canDrag() method, and have it return 
false. If you want all objects of that class to be undraggable, you'd 
want to subclass, e.g.

	class Cone < Fox::FXGLCone
		def canDrag
			false
		end
	end

or if it's just one particular object that you don't want to be 
draggable:

	cone = FXGLCone.new(...)
	def cone.canDrag; false; end

Hope this helps,

Lyle




More information about the fxruby-users mailing list