constraint

Constraints are items located in option -constraint.

$group constraint
returns list of constraints
$group constraint noprint
returns yes if noprint is set, otherwise returns no
$group constraint noprint yes
sets constraint noprint

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 group 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