createSelRect

$canvaseditor createSelRect enclosed
interactively creates selection range, select touching or enclosed, for later selectByRect


obj method canvaseditor createSelRect {{how enclosed}} {
  set canvas [my canvas]
  $self basicBindings off
  $self statusLine Select area $how
  lassign [pointerXY] x y
  $self pointerToXY $x $y
  set x [$self canvas canvasx $x]
  set y [$self canvas canvasy $y]
  $self canvas delete selection
  $self canvas create rectangle $x $y $x $y -dash "7 7" -tags selection
  bind $canvas <<Click>> "$self selectByRect $how"
  bind $canvas <Motion> [subst -nocommand {
      $self canvas coords selection $x $y\
      [$self canvas canvasx %x] [$self canvas canvasy %y]
    }]
}

© Wolf-Dieter Busch | Home | Sitemap | Urheber | A-Z