Another FXRuby question


#1

I have some button that do DND, but I also want to click them to perform
some actions.
I’m not sure, but right now it seems like my
imageView.connect(SEL_COMMAND) isn’t doing anything.
The puts I have in there never get outputted.

imageView= FXButton.new(@stackViewer, nil, nil, nil, 0,
LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|BUTTON_NORMAL, 0,0, 357, 497)
imageView.icon = FXJPGIcon.new(self.getApp(), file.read,
IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP)
#set action for selected button
imageView.connect(SEL_COMMAND) do
put “in imageView.connect”
if card.commander == requesting_player
puts card.stopped
card.stopped ? stack.unstop(card) : stack.stop(card)
self.display(stack, requesting_player)
end
end
#set DND for cards in viewer
imageView.connect(SEL_LEFTBUTTONPRESS) do
imageView.grab
dragTypes = [@image_drag_type]
imageView.beginDrag(dragTypes)
end
imageView.connect(SEL_MOTION) do |sender, sel, event|
if imageView.dragging?
imageView.handleDrag(event.root_x, event.root_y)
unless imageView.didAccept == DRAG_REJECT
imageView.dragCursor =
self.getApp().getDefaultCursor(DEF_DNDMOVE_CURSOR)
else
imageView.dragCursor =
self.getApp().getDefaultCursor(DEF_DNDSTOP_CURSOR)
end
end
end
imageView.connect(SEL_LEFTBUTTONRELEASE) do
imageView.ungrab
imageView.endDrag
stack.remove(card) if data_sent
self.display(stack, requesting_player)
end
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))
data_sent = true
end
end
imageView.create