Moves an object.

syntaxSyntax:
DlxObject.Move(dx, dy)

Parameters

Parameter Description
dx Define a horizontal displacement indicating how far the given object is to be moved and in what direction.
dy Define a vertical displacement indicating how far the given object is to be moved and in what direction.

Return Value

If the operation ends correctly it returns true otherwise it returns false.

Example

  Copy codeCopy code
var prj = DlxApp.GetJob().GetProject("Example Sch");
if (!prj.IsValid())
  prj = DlxApp.GetJob().NewProject("Example Sch");
var doc = prj.GetDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
if (!doc.IsValid())
{
  doc = prj.NewDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
  doc.SetPageFormat("A4", false);
}
if (doc.IsValid() && doc.Activate())
{
  var page = doc.GetActivePage();
  if (page.IsValid())
  {
    var layer = page.GetLayerFromType(DlxApp.LAYERTYPE_DRAWING);
    if (layer.IsValid())
    {
      // create objects
      var pen = new DlxPenStyle(0.5, new DlxColor("orangered"), "DASHED");
      doc.SetStyle(pen);
      var obj = layer.DrawLine(new DlxPoint(30, 30), new DlxPoint(80, 80));
       // moves object
      var dlg = new DlxDialog(200, 120, "Move");
      if (dlg.IsValid())
      {
        dlg.AddStaticText(20, 23, 60, "dx:");
        var dx = dlg.AddEditNumber(90, 20, 100, DlxApp.DIALOGEDITNUMBER_LENGTH, 0, -100, 100);
        dlg.AddStaticText(20, 48, 60, "dy:");
        var dy = dlg.AddEditNumber(90, 45, 100, DlxApp.DIALOGEDITNUMBER_LENGTH, 0, -100, 100);
        dlg.AddOkButton(80, 80, 50, 25);
        dlg.AddCancelButton(140, 80, 50, 25);
        if (dlg.DoModal())
        {
          obj.Move(dx.GetNumber(), dy.GetNumber());
        }
      }
    }
  }
}

See also