constraint

Constraints are items located in option -constraint.

$line constraint
returns list of constraints
$line constraint noprint
returns yes if constraint noprint is set, otherwise returns no
$line constraint noprint bool
sets or unsets constraint

These constraints are realized:

noprint
suppress printing of object if used for internal purposes only
size
suppress scaling
orient
suppress rotating
shear
suppress shearing horizontal, vertical, but not diagonal
fillcolor
fix color of fill objects
linecolor
fix color of line objects
linewidth
fix width of line objects
gravity
preferring objecs for some purposes

obj method line constraint {{what {}} {how info}} {
  set constr [$self cget -constraint]
  if {$what eq ""} then {
    set constr
  } elseif {$how eq "info"} then {
    expr {$what in [$self cget -constraint] ? yes : no}
  } elseif {$how eq "toggle"} then {
    if {[$self constraint $what]} then {
      $self constraint $what no
    } else {
      $self constraint $what yes
    }
  } elseif {$how} then {
    if {$what ni $constr} then {
      lappend constr $what
      $self configure -constraint $constr
    }
  } else {
    set index [lsearch $constr $what]
    $self configure -constraint [lreplace $constr $index $index]
  }
}

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