Scrolling two different widgets will one scrollbar 
Author Message
 Scrolling two different widgets will one scrollbar

It's possible in TCL/TK to scroll two different widgets (my case they are
canvases) with
one scrollbar. I just want to have an Y scrollbar to be common on two
canvas.

 canvas .ss.time.cleft -width 80 -height 460 -relief sunken -bd 2 \
  -scrollregion {0c 0c 10c 30c } \
  -yscrollcommand ".ss.time.yscroll set"
 canvas .ss.time.cright -width 378 -height 460 -relief sunken -bd 2 \
  -scrollregion { 0c 0c 60c 30c } \
  -xscrollcommand ".ss.time.xscroll set" \
  -yscrollcommand ".ss.time.yscroll set"
 scrollbar .ss.time.xscroll -orient horiz \
  -command ".ss.time.cright xview"
 scrollbar .ss.time.yscroll -command  {
   .ss.time.cright yview
   .ss.time.cleft yview
 }

If you notice the last scrollbar command, I thought that was most logical
definition. But it didn't work.

JR



Mon, 21 May 2001 03:00:00 GMT  
 Scrolling two different widgets will one scrollbar

Quote:

> It's possible in TCL/TK to scroll two different widgets (my case they are
> canvases) with
> one scrollbar. I just want to have an Y scrollbar to be common on two
> canvas.

>  canvas .ss.time.cleft -width 80 -height 460 -relief sunken -bd 2 \
>   -scrollregion {0c 0c 10c 30c } \
>   -yscrollcommand ".ss.time.yscroll set"
>  canvas .ss.time.cright -width 378 -height 460 -relief sunken -bd 2 \
>   -scrollregion { 0c 0c 60c 30c } \
>   -xscrollcommand ".ss.time.xscroll set" \
>   -yscrollcommand ".ss.time.yscroll set"
>  scrollbar .ss.time.xscroll -orient horiz \
>   -command ".ss.time.cright xview"
>  scrollbar .ss.time.yscroll -command  {
>    .ss.time.cright yview
>    .ss.time.cleft yview
>  }

> If you notice the last scrollbar command, I thought that was most logical
> definition. But it didn't work.

> JR

The real definition of the scrollbar command is such that several
parameters are appended to it at execution time.

Confused? Ok, do instead:

proc scroller {W1 W2 v1 v2 v3} {
$W1 yview $v1 $v2 $v3
$W2 yview $v1 $v2 $v3

Quote:
}

scrollbar .ss.time.yscroll -command \
   "scroller .ss.time.cleft .ss.time.cright"


Mon, 21 May 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Two canvas scrolled simultaneously by the same scrollbar (an UNIQUE scrollbar and TWO or more canvas)

2. Scrolling two listboxes with one scrollbar?

3. Two canvases (widgets), one scrollbar..

4. How to use one scrollbar to control two text widgets

5. Synchronizing two text- widgets to one scrollbar ?

6. controlling two texts widgets with one scrollbar

7. SYNCHRONIZED SCROLLING, or, ONE SCROLLBAR TO SCROLL 2CanvasesWindows

8. one scroll bar for two text widgets

9. one scrollbar for more than one widget

10. help with scrolling two listboxes by the single scrollbar

11. Scroll multiple windows with one scrollbar ?

12. scrolling multiple windows with one scrollbar

 

 
Powered by phpBB® Forum Software