binding a scroll bar to an image 
Author Message
 binding a scroll bar to an image

hi,

Quote:
> I've no good idea on how to do this.  I can create a scrolling list,
> but I cannot create a scrolling image.  Can someone send me a sample
> of code which would point me in the right direction?  Just enough to
> get the gist.

me too me tooo... ;)

--
Bye,                             Linux/Babes
  Adam Kopacz (kLospatz)     http://www.*-*-*.com/



Mon, 27 Mar 2000 03:00:00 GMT  
 binding a scroll bar to an image

: --------------F343DBC4FC8945428B1A9AE2
: Content-Type: text/plain; charset=us-ascii
: Content-Transfer-Encoding: 7bit

: This may be a trivial question, but I'm new to Tcl/Tk, and as such I've
: no good idea on how to do this.  I can create a scrolling list, but I
: cannot create a scrolling image.  Can someone send me a sample of code
: which would point me in the right direction?  Just enough to get the
: gist.

assume that you have name of image file (gif) in file variable
and desired width and height in width and height variables respectively

I use root window to hold scrollable image (adequate for testing) and
use grid geometry manager in it (if you don't like grid, use pack same
way as it is shown for scrollable canvas in native Tk demo)

canvas .i -width $width -height $height -xscrollcommand ".x set" \
        -yscrollcommand ".y set"
scrollbar .x -orient horiz -command ".i xview"
scrollbar .y -orient vert -command ".i yview"

grid .i .y -sticky news
grid .x -sticky news
# following four lines to get proper window resizing
grid rowconfigure . 0 -weight 1
grid rowconfigure . 1 -weight 0
grid columnconfigure . 0 -weight 1
grid columnconfigure . 1 -weight 0
# creating image on canvas
.i create image 0 0 -anchor nw -image [image create photo -file $file]
# this is the key - we set scrollable region to size of all our drawing
.i configure -scrollregion [.i bbox all]



Tue, 28 Mar 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. only add a scroll bar when the window is minimized and scroll bar is needed

2. displaying images and scroll bars..

3. VWIN32: Smaller title bar and scroll bars? (fwd)

4. VWIN32: Smaller title bar and scroll bars?

5. Mouse wheel doesn't scroll text scroll bar

6. text widget / scroll bar / automatic scrolling

7. Is there any way to apply scroll-ability to an image without displaying the scroll-bars?

8. ASPAP: How do you change your scroll bars to be flat scroll bars?

9. Listbox doesn't get scroll bars

10. scroll bar

11. Width/height of scroll bar in listbox

12. Editfield & Scroll Bar Position

 

 
Powered by phpBB® Forum Software