"Damien B." a écrit :
Voici mon code (désolé mais je ne peux pas trop publier mon code, mon adresse
email est valide, je peux t'envoyer une snapshot de ce que ça donne si tu veux)
# Déclaration des canvas
set cans(Header) [canvas $interior.canheader -highlightthickness 0 -width 190
-height 50]
set cans(RegisterList) [canvas $interior.canreglist -highlightthickness 0 -width
$preferencesRegisterWidth -background black]
set cans(ValueList) [canvas $interior.canvallist -highlightthickness 0 -width
$preferencesValueWidth -background black]
set cans(Separator0) [canvas $interior.cansep0 -highlightthickness 0 -width 5]
set cans(Separator1) [canvas $interior.cansep1 -highlightthickness 0 -width 5]
set cans(Bits) [canvas $interior.canbits -highlightthickness 0 -height 50
-background black]
set cans(DrawArea) [canvas $interior.candraw -highlightthickness 0 -background
black]
set cans(ValueAlign) [canvas $interior.canalign -highlightthickness 0 -width 17
-height 17]
# Déclaration des scrollbar
set scroll(RegisterList) [scrollbar $interior.scrollreg -orient horizontal]
set scroll(ValueList) [scrollbar $interior.scrollval -orient horizontal]
set scroll(DrawX) [scrollbar $interior.scrollx -orient horizontal]
set scroll(DrawY) [scrollbar $interior.scrolly -orient vertical]
# Configuration des canvas pour le scroll (une scrollbar peut commander plus
d'un canvas)
$cans(DrawArea) configure -yscrollcommand [list $scroll(DrawY) set]
-yscrollincrement [expr $yfont15 + $yfont10]
$cans(DrawArea) configure -xscrollcommand [list $scroll(DrawX) set]
$cans(RegisterList) configure -yscrollcommand [list $scroll(DrawY) set]
-yscrollincrement [expr $yfont15 + $yfont10]
$cans(RegisterList) configure -xscrollcommand [list $scroll(RegisterList) set]
$cans(ValueList) configure -yscrollcommand [list $scroll(DrawY) set]
-yscrollincrement [expr $yfont15 + $yfont10]
$cans(ValueList) configure -xscrollcommand [list $scroll(ValueList) set]
# Configuration des scrollbars
$scroll(DrawX) configure -command [itcl::code $this scrollX $cans(DrawArea)
[list $cans(DrawArea) $cans(Bits)]]
$scroll(DrawY) configure -command [itcl::code $this scrollY $cans(DrawArea)
[list $cans(DrawArea) $cans(RegisterList) $cans(ValueList)]]
$scroll(RegisterList) configure -command [itcl::code $this scrollX
$cans(RegisterList) [list $cans(RegisterList)]]
$scroll(ValueList) configure -command [itcl::code $this scrollX $cans(ValueList)
[list $cans(ValueList)]]
# Le binding pour la molette de la souris (pour scroller quand on bouge la
molette)
bind $cans(DrawArea) <4> [list [itcl::code $this scrollY] $cans(DrawArea) [list
$cans(DrawArea) $cans(RegisterList) $cans(ValueList)] scroll -1 units]
bind $cans(DrawArea) <5> [list [itcl::code $this scrollY] $cans(DrawArea) [list
$cans(DrawArea) $cans(RegisterList) $cans(ValueList)] scroll 1 units]
bind $cans(RegisterList) <4> [list [itcl::code $this scrollY] $cans(DrawArea)
[list $cans(DrawArea) $cans(RegisterList) $cans(ValueList)] scroll -1 units]
bind $cans(RegisterList) <5> [list [itcl::code $this scrollY] $cans(DrawArea)
[list $cans(DrawArea) $cans(RegisterList) $cans(ValueList)] scroll 1 units]
bind $cans(ValueList) <4> [list [itcl::code $this scrollY] $cans(DrawArea) [list
$cans(DrawArea) $cans(RegisterList) $cans(ValueList)] scroll -1 units]
bind $cans(ValueList) <5> [list [itcl::code $this scrollY] $cans(DrawArea) [list
$cans(DrawArea) $cans(RegisterList) $cans(ValueList)] scroll 1 units]
# Le placement en utilisant grid
grid columnconfigure $interior 6 -weight 1
grid rowconfigure $interior 1 -weight 1
grid $cans(Header) -sticky nwes -column 0 -row 0 -columnspan 4
grid $cans(RegisterList) -sticky nwes -column 0 -row 1
grid $scroll(RegisterList) -sticky we -column 0 -row 2
grid $cans(Separator0) -sticky ns -column 1 -row 1 -rowspan 2
grid $cans(ValueList) -sticky nwes -column 2 -row 1 -columnspan 3
grid $scroll(ValueList) -sticky we -column 2 -row 2 -columnspan 2
grid $cans(ValueAlign) -sticky e -column 4 -row 2
grid $cans(Separator1) -sticky ns -column 5 -row 0 -rowspan 3
grid $cans(Bits) -sticky nwes -column 6 -row 0
grid $cans(DrawArea) -sticky nwes -column 6 -row 1
grid $scroll(DrawX) -sticky we -column 6 -row 2
grid $scroll(DrawY) -sticky ns -column 7 -row 1