Reply To: Conditional feedback based on DragDrop response

PennController for IBEX Forums Support Conditional feedback based on DragDrop response Reply To: Conditional feedback based on DragDrop response

#8299
Jeremy
Keymaster

Hi,

EDIT: actually you do need callback if you want to only move on when dropping in the right box:

newText("yes"),newText("no", "drop in the other box")
,
		
newDragDrop("dd", "bungee")
	.log("all")
	.addDrop(
		getText(first_arg), 
		getText(second_arg)
	)
	.addDrag(getText("word"))
	.callback( 
	    getText("yes").remove(),getText("no").remove()
	    ,
	    self.test.dropped( getText(target_res) )
        	.success( getText("yes").print() )
        	.failure( getText("no").print() )
	)
	.offset('0.5em', '0.1em', 
		getText(first_arg), 
		getText(second_arg)
	)
	.wait( self.test.dropped(getText(target_res)) )
	.removeDrag(getText("word"))
	.removeDrop(
		getText(first_arg), 
		getText(second_arg)
	)
,

getMouseTracker("mouse").stop()
,

End of EDIT

You don’t need to use callback, just test whether the Text element whose name corresponds to the value of target_res is the one that received the draggable element after wait:

newDragDrop("dd", "bungee")
	.log("all")
	.addDrop(
		getText(first_arg), 
		getText(second_arg)
	)
	.addDrag(getText("word"))
	.offset('0.5em', '0.1em', 
		getText(first_arg), 
		getText(second_arg)
	)
	.wait()
	.test.dropped( getText(target_res) )
	.success( newText("yes").print() )
	.failure( newText("no").print() )
	.removeDrag( getText("word") )
	.removeDrop(
		getText(first_arg), 
		getText(second_arg)
	)
,

getMouseTracker("mouse").stop()
,

Jeremy

  • This reply was modified 1 year, 9 months ago by Jeremy.