[fxruby-users] drag n drop help

Raj Sahae rajsahae at gmail.com
Mon Mar 5 17:40:52 EST 2007


I want to be able to drag an object, in it's entirety.  Right now, I am 
dragging objects by defining a to_s and card_from_str methods, but there 
are several subclasses of these objects and writing the string 
conversion methods is tedious for each one.  Is there another way to 
drag an object?

Sample of my code:
imageView.connect(SEL_DND_REQUEST) do |sender, sel, event|
    if event.target == @image_drag_type
        imageView.setDNDData(FROM_DRAGNDROP, @image_drag_type,
              Fox.fxencodeStringData(card.to_s))
    end
end

@DilemmaBottomButton.connect(SEL_DND_DROP) do
     data = @DilemmaBottomButton.getDNDData(FROM_DRAGNDROP, 
@image_drag_type)
     @DilemmaBottomButton.dropFinished
     data = Fox.fxdecodeStringData(data) unless data.nil?
     card = @game.players[@this_player].card_from_str(data)
end



More information about the fxruby-users mailing list