home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!caen!spencer
- From: spencer@med.umich.edu (Spencer W. Thomas)
- Subject: Re: Scrollable buttons?
- Message-ID: <SPENCER.92Nov19031842@guraldi.med.umich.edu>
- Date: Thu, 19 Nov 92 03:18:42 EST
- Organization: University of Michigan
- In-Reply-To: trones@dxcern.cern.ch's message of Tue, 17 Nov 1992 10:26:54 GMT
- References: <1992Nov17.102654.15449@dxcern.cern.ch>
- Nntp-Posting-Host: guraldi.itn.med.umich.edu
- Lines: 30
-
- I'm putting windows on (in?) a canvas for an application I'm writing.
- It's not trivial, but it's not too hard, either.
-
- - Use winfo reqheight/reqwidth to figure out how big the window will
- be. Then you can use whatever placement algorithm you want. I just
- place my windows in rows, with a "return" whenever a window
- threatens to overrun the (current) right edge of the canvas (as
- determined by 'winfo width <canvas>').
-
- - After placing all the windows, make sure the scrolling region is big
- enough.
-
- - All events inside the window go to the window, NOT the canvas. This
- is a pain if you want to be able to drag the windows. I use code
- like this:
-
- bind $w <3> "itemStartDrag $theCanvas \[expr %x+\[winfo x $w]]\
- \[expr %y+\[winfo y $w]]";
- bind $w <B3-Motion> "itemDrag $theCanvas \
- \[expr %x+\[winfo x $w]]\
- \[expr %y+\[winfo y $w]] $tag";
- bind $f <Any-Enter> "itemEnter $theCanvas $field";
- bind $f <Any-Leave> "itemLeave $theCanvas";
- where $w is the window name, and $tag is a tag for the window.
- itemEnter for a window "raises" it (in relief).
-
- --
- =Spencer W. Thomas | Info Tech and Networking, B1911 CFOB, 0704
- "Genome Informatician" | Univ of Michigan, Ann Arbor, MI 48109
- Spencer.W.Thomas@med.umich.edu | 313-747-2778, FAX 313-764-4133
-