home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!news-is-not-mail
- From: capo@cs.utexas.edu (Charles Read)
- Newsgroups: comp.lang.tcl
- Subject: tricky problem with "place" command
- Date: 7 Jan 1993 11:26:23 -0600
- Organization: CS Dept, University of Texas at Austin
- Lines: 83
- Message-ID: <1ihp3vINNis9@im4u.cs.utexas.edu>
- NNTP-Posting-Host: im4u.cs.utexas.edu
- Keywords: placer, geometry manager
-
- The code below packs two frames (vertically) inside
- a toplevel window. The top frame contains a menu.
- The bottom frame contains a pair of scrollbars.
- When the toplevel window is resized, the scrollbars
- should be proportionately resized. That's why I use
- the "place" command. The problem is that the bottom
- frame always tries to fill the whole toplevel window
- when it should really fill just the whole area BELOW
- the menubar.
- If you have clues how to fix this, please let me know.
- -c
- ---------------------------cut here-------------------------
- #!/usr/local/bin/wish -f
- proc sdmCreateMenu {w} {
- # Create and pack the menu.
- frame $w.menu -relief flat -borderwidth 1
- pack append $w $w.menu {top fillx}
-
- # File menu.
- menubutton $w.menu.file -text "File" -menu $w.menu.file.m
- menu $w.menu.file.m
- $w.menu.file.m add command -label "Quit" -command exit
-
- # Props menu.
- menubutton $w.menu.props -text "Props" -menu $w.menu.props.m
- menu $w.menu.props.m
- $w.menu.props.m add command -label "Test1" -command "echo Test1"
- $w.menu.props.m add command -label "Test2" -command "echo Test2"
-
- # Styles menu.
- menubutton $w.menu.styles -text "Styles" -menu $w.menu.styles.m
- menu $w.menu.styles.m
- $w.menu.styles.m add command -label "Points" -command "echo Unsupported"
- $w.menu.styles.m add command -label "Lines" -command "echo Unsupported"
-
- # Pack all the menus
- pack append $w.menu \
- $w.menu.file left \
- $w.menu.props left \
- $w.menu.styles left
- }
-
- wm withdraw .
-
- set bx 32
- set by 32
- set bh 286
- set bw 186
- set w .zot
- set cwidth 350
- set cheight 250
- toplevel $w
-
- # Create and pack the menu.
- frame $w.menu -relief flat -borderwidth 1
- pack append $w $w.menu {top fillx}
- sdmCreateMenu $w.menu
-
- # this specifies a minimum size AND allows for resizing.
- wm minsize $w $cwidth $cheight
-
- # Make a frame and canvas for the new window.
- frame $w.frame -relief flat -bd 2
- pack append $w $w.frame {top expand}
- canvas $w.frame.c -relief flat -width $cwidth -height $cheight
-
- # Let the "placer" handle size-tracking for the canvas and scrollbars.
- place $w.frame -relwidth 1.0 -relheight 1.0
- # place $w.frame -in $w.menu -relx 0.0 -rely 0.0 -anchor nw
-
- scrollbar $w.frame.hscroll -orient horiz -relief sunken \
- -width 12
- $w.frame.hscroll set $bw $bw 0 [expr $bw-1]
- pack append $w.frame $w.frame.hscroll {bottom fillx}
-
- scrollbar $w.frame.vscroll -orient vert -relief sunken \
- -width 12
- $w.frame.vscroll set $bh $bh 0 [expr $bh-1]
- pack append $w.frame $w.frame.vscroll {right filly}
-
- # pack canvas
- pack append $w.frame $w.frame.c {expand fill}
-
-