ApplicationDraggable.LocationChanged
event · ApplicationDraggable · cAlgo.API Since 5.2
DesktopCLICloud
Occurs when the draggable's location is changed.
Environment behaviour
CLI — not supported. Never displayed: starts at X=0, Y=0; position changes are not applied and LocationChanged never fires.
Cloud — not supported. Never displayed: starts at X=0, Y=0; position changes are not applied and LocationChanged never fires.
Definition
event Action<ApplicationDraggableLocationChangedEventArgs> LocationChanged;
applicationDraggable.LocationChanged += handler # handler(obj: ApplicationDraggableLocationChangedEventArgs)
Examples
protected override void OnStart()
{
var draggable = Application.Draggables.Add();
draggable.Child = new TextBlock { Text = SymbolName };
draggable.LocationChanged += OnDraggableLocationChanged;
}
private void OnDraggableLocationChanged(ApplicationDraggableLocationChangedEventArgs args)
{
Print("Draggable moved to {0}, {1}", args.Draggable.X, args.Draggable.Y);
}
def on_start(self):
draggable = api.Application.Draggables.Add()
textBlock = TextBlock()
textBlock.Text = api.SymbolName
draggable.Child = textBlock
draggable.LocationChanged += self.on_draggable_location_changed
def on_draggable_location_changed(self, args):
api.Print(f"Draggable moved to {args.Draggable.X}, {args.Draggable.Y}")