From sven@cimetrix.com  Sun Jul  2 14:57:53 1995
Posted-Date: Sun, 2 Jul 1995 14:57:48 -0400
Received-Date: Sun, 2 Jul 1995 14:57:48 -0400
Received: (from mail@localhost) by cheetah.cimetrix.com (8.6.9/8.6.9) id AAA11274 for <ioi@graphics.cis.upenn.edu>; Sun, 2 Jul 1995 00:33:06 -0600
Received: from cougar.cimetrix.com(192.0.0.186) by cheetah.cimetrix.com via smap (V1.3)
	id sma011272; Sun Jul  2 00:32:37 1995
Received: by cougar.cimetrix.com; Sun, 2 Jul 1995 12:35:51 -0600
Date: Sun, 2 Jul 1995 12:35:51 -0600
From: sven@cimetrix.com (Sven Delmas)
Message-Id: <199507021835.MAA02956@cougar.cimetrix.com>
To: ioi@graphics.cis.upenn.edu
In-reply-to: <199506211824.OAA21844@graphics.cis.upenn.edu> (ioi@graphics.cis.upenn.edu)
Subject: Re: tixForm bug
Status: RO


Sorry for the delay... I was quite busy...

some notes, and changes to the latest Tix beta release. 
During compilation I found these problems:

	1) strdup is not a POSIX function, so the prototype
           is not available. This causes my IRIX compiler
           to stop compiling because he either wants the
           prototype or a cast to (char *).

	2) actually not a bug, but the Notebook buttons
           have a very small radius if the borderwidth is
           1. This way they look almost square... is there
           a way to make the radius a little bit larger ?

	3) is the notebook page option -state supposed
           to work ?
	
I made the following changes to the tix library. Some of them
are fixes some are enhancements and some reflect my personal
needs. I hope it is not a problem that they are all mixed
together... it is not much that I change (if it is too 
much work... let me know and I will try to make a commented
list of changes).

*** ComboBox.tcl.OLD	Fri Jun 30 08:03:04 1995
--- ComboBox.tcl	Fri Jun 30 08:03:04 1995
***************
*** 28,34 ****
  	-disablecallback -disabledforeground -dropdown -editable
  	-fancy -grab -histlimit -historylimit -history -listcmd  -listwidth
  	-prunehistory -selection -selectmode -state -tickbitmap -validatecmd
! 	-value -variable
      }
      -static {
  	-fancy
--- 28,34 ----
  	-disablecallback -disabledforeground -dropdown -editable
  	-fancy -grab -histlimit -historylimit -history -listcmd  -listwidth
  	-prunehistory -selection -selectmode -state -tickbitmap -validatecmd
! 	-value -variable -listheight -entrywidth
      }
      -static {
  	-fancy
***************
*** 46,54 ****
--- 46,56 ----
  	{-disabledforeground disabledForeground DisabledForeground #606060}
  	{-dropdown dropDown DropDown true}
  	{-editable editable Editable false}
+         {-entrywidth entryWidth EntryWidth {}}
  	{-fancy fancy Fancy false}
  	{-grab grab Grab global}
  	{-listcmd listCmd ListCmd {}}
+ 	{-listheight listHeight ListHeight {}}
  	{-listwidth listWidth ListWidth {}}
  	{-historylimit historyLimit HistoryLimit {}}
  	{-history history History false}
***************
*** 87,92 ****
--- 89,95 ----
  	{*Entry.background			#c3c3c3}
  	{*Label.font                   -Adobe-Helvetica-Bold-R-Normal--*-120-*}
      }
+     -forcecall {-entrywidth}
  }
  
  proc tixComboBox::InitWidgetRec {w} {
***************
*** 278,283 ****
--- 281,289 ----
      bindtags $data(w:entry) \
         "$data(w:entry) Entry TixComboEntry [winfo toplevel $data(w:entry)] all"
  
+     bindtags $data(w:slistbox) \
+        "Listbox $data(w:slistbox) [winfo toplevel $data(w:slistbox)] all"
+ 
      # (3) The listbox and slistbox
      #
      $data(w:slistbox) config -browsecmd "tixComboBox::LbBrowse  $w"


***************
*** 453,458 ****
--- 459,479 ----
      tixComboBox::ClearListboxSelection $w
  }
  
+ proc tixComboBox::config-entrywidth {w value} {
+   upvar #0 $w data
+ 
+   if {"$value" != "0"} {
+     if {"$value" != ""} {
+       pack $data(w:entry) -side left -fill x -expand yes -padx 1
+       $data(w:entry) config -width $value -takefocus 1
+     }
+   } {
+     $data(w:entry) config -takefocus 0
+     catch "pack forget $data(w:entry)"
+   }
+   return
+ }
+ 
  proc tixComboBox::pick {w index} {
      upvar #0 $w data
      

***************
*** 861,888 ****
  
      set bd [$data(w:shell) cget -bd]
      incr bd [$data(w:shell) cget -highlightthickness]
!     set height [expr [winfo reqheight $data(w:slistbox)] + 2*$bd]
! 
      set x1 [winfo rootx $data(w:entry)]
      if {$data(-listwidth) == {}} {
! 	set x2  [winfo rootx $data(w:arrow)]
! 	incr x2 [winfo width $data(w:arrow)]
! 	set width  [expr "$x2 - $x1"]
      } else {
! 	set width $data(-listwidth)
! 	set x2 [expr $x1 + $width]
      }
  
      set reqwidth [winfo reqwidth $data(w:shell)]
      if {$reqwidth < $width} {
! 	set reqwidth $width
      } else {
! 	if {$reqwidth > [expr $width *3]} {
! 	    set reqwidth [expr $width *3]
! 	}
! 	if {$reqwidth > [winfo vrootwidth .]} {
! 	    set reqwidth [winfo vrootwidth .]
! 	}
      }
      set width $reqwidth
  
--- 885,918 ----
  
      set bd [$data(w:shell) cget -bd]
      incr bd [$data(w:shell) cget -highlightthickness]
!     if {$data(-listheight) == {}} {
!       set height [expr [winfo reqheight $data(w:slistbox)] + 2*$bd]
!     } {
!       set height $data(-listheight)
!     }
!     if {$height <= 30} {
!       set height 180
!     }
      set x1 [winfo rootx $data(w:entry)]
      if {$data(-listwidth) == {}} {
!         set x2  [winfo rootx $data(w:arrow)]
!         incr x2 [winfo width $data(w:arrow)]
!         set width  [expr "$x2 - $x1"]
      } else {
!         set width $data(-listwidth)
!         set x2 [expr $x1 + $width]
      }
  
      set reqwidth [winfo reqwidth $data(w:shell)]
      if {$reqwidth < $width} {
!         set reqwidth $width
      } else {
!         if {$reqwidth > [expr $width *3]} {
!             set reqwidth [expr $width *3]
!         }
!         if {$reqwidth > [winfo vrootwidth .]} {
!             set reqwidth [winfo vrootwidth .]
!         }
      }
      set width $reqwidth
  
***************
*** 890,902 ****
      #
      set scrwidth [winfo vrootwidth .]
      if {$x2 > $scrwidth} {
! 	set x1 [expr $scrwidth - $width]
      }
  
      # If the listbox is too far left, pull it back to the right
      #
      if {$x1 < 0} {
! 	set x1 0
      }
  
      # If the listbox is below bottom of screen, put it upwards
--- 920,932 ----
      #
      set scrwidth [winfo vrootwidth .]
      if {$x2 > $scrwidth} {
!         set x1 [expr $scrwidth - $width]
      }
  
      # If the listbox is too far left, pull it back to the right
      #
      if {$x1 < 0} {
!         set x1 0
      }
  
      # If the listbox is below bottom of screen, put it upwards
***************
*** 904,910 ****
      set scrheight [winfo vrootheight .]
      set bottom [expr $y+$height]
      if {$bottom > $scrheight} {
! 	set y [expr $y-$height-[winfo height $data(w:entry)]-5]
      }
   
      # OK , popup the shell
--- 934,940 ----
      set scrheight [winfo vrootheight .]
      set bottom [expr $y+$height]
      if {$bottom > $scrheight} {
!         set y [expr $y-$height-[winfo height $data(w:entry)]-5]
      }
   
      # OK , popup the shell
***************
*** 920,935 ****
      #
      $data(rootCmd) config -cursor arrow
      catch {
! 	# We catch here because grab may fail under a lot of circumstances
! 	# Just don't want to break the code ...
! 	case $data(-grab) {
! 	    global {
! 		grab -global $data(w:root)
! 	    }
! 	    local {
! 		grab $data(w:root)
! 	    }
! 	}
      }
  }
  
--- 950,965 ----
      #
      $data(rootCmd) config -cursor arrow
      catch {
!         # We catch here because grab may fail under a lot of circumstances
!         # Just don't want to break the code ...
!         case $data(-grab) {
!             global {
!                 grab -global $data(w:root)
!             }
!             local {
!                 grab $data(w:root)
!             }
!         }
      }
  }
  
***************
*** 941,950 ****
      upvar #0 $w data
  
      if {$data(-dropdown) == "true" && $data(popped)} {
! 	wm withdraw $data(w:shell)
! 	$data(rootCmd) config -cursor {}
  	grab release $data(w:root)
! 	set data(popped) 0
      }
  }
  
--- 971,980 ----
      upvar #0 $w data
  
      if {$data(-dropdown) == "true" && $data(popped)} {
!         wm withdraw $data(w:shell)
!         $data(rootCmd) config -cursor {}
  	grab release $data(w:root)
!         set data(popped) 0
      }
  }
  

*** OptMenu.tcl.OLD	Fri Jun 30 08:03:10 1995
--- OptMenu.tcl	Fri Jun 30 08:03:10 1995
***************
*** 5,11 ****
  	add disable enable 
      }
      -flag {
! 	-command -disablecallback -value -variable 
      }
      -forcecall {
  	-variable -state
--- 5,11 ----
  	add disable enable 
      }
      -flag {
! 	-command -disablecallback -value -variable -state
      }
      -forcecall {
  	-variable -state
***************
*** 17,22 ****
--- 17,23 ----
  	{-value value Value {}}
  	{-variable variable Variable {}}
      }
+     -forcecall {-state}
      -default {
  	{.frame.menubutton.relief		raised}
  	{.frame.menubutton.borderWidth		2}
***************
*** 38,52 ****
  
      tixChainMethod $w ConstructFramedWidget $frame
  
!     set data(w:menubutton) [menubutton $frame.menubutton -indicatoron 1]
      set data(w:menu)       [menu $frame.menubutton.menu -tearoff 0]
!     pack $data(w:menubutton) -side left -expand yes -fill both
  
      $data(w:menubutton) config -menu $data(w:menu)
  
      tixSetMegaWidget $data(w:menubutton) $w
  }
  
  proc tixOptionMenu::SetBindings {w} {
      upvar #0 $w data
  
--- 39,59 ----
  
      tixChainMethod $w ConstructFramedWidget $frame
  
!     set data(w:menubutton) [menubutton $frame.menubutton -indicatoron 1 -borderwidth 0]
      set data(w:menu)       [menu $frame.menubutton.menu -tearoff 0]
!     pack $data(w:menubutton) -side left -expand yes -fill both -padx 1 -pady 1
  
      $data(w:menubutton) config -menu $data(w:menu)
  
      tixSetMegaWidget $data(w:menubutton) $w
  }
  
+ proc tixOptionMenu::config-state {w value} {
+     upvar #0 $w data
+ 
+   $data(w:menubutton) config -state $value
+ }
+ 
  proc tixOptionMenu::SetBindings {w} {
      upvar #0 $w data
  
***************
*** 59,65 ****
  proc tixOptionMenu::Invoke {w name} {
      upvar #0 $w data
  
!     tixOptionMenu::SetValue $w $name
  }
  
  proc tixOptionMenu::SetValue {w value {noUpdate 0}} {
--- 66,74 ----
  proc tixOptionMenu::Invoke {w name} {
      upvar #0 $w data
  
!     if {"$data(-state)" == "normal"} {
!         tixOptionMenu::SetValue $w $name
!     }
  }
  
  proc tixOptionMenu::SetValue {w value {noUpdate 0}} {
***************
*** 146,152 ****
  	    #
  	    eval $data(w:menu) add command $args \
  		[list -label $opt(-label) \
! 		-command "tixOptionMenu::Invoke $w $name"]
  	    set index $data(nItems)
  
  	    # Store info about this item
--- 155,161 ----
  	    #
  	    eval $data(w:menu) add command $args \
  		[list -label $opt(-label) \
! 		-command "tixOptionMenu::Invoke $w \{$name\}"]
  	    set index $data(nItems)
  
  	    # Store info about this item
*** PanedWin.tcl.OLD	Fri Jun 30 08:03:11 1995
--- PanedWin.tcl	Fri Jun 30 08:03:11 1995
***************
*** 2,8 ****
      -classname TixPanedWindow
      -superclass tixPrimitive
      -method {
! 	add paneconfigure
      }
      -flag {
  	-command -handleactivebg -handlebg -orientation
--- 2,8 ----
      -classname TixPanedWindow
      -superclass tixPrimitive
      -method {
! 	add paneconfigure panename panes
      }
      -flag {
  	-command -handleactivebg -handlebg -orientation
***************
*** 90,101 ****
  
      # The default values
      #
      set option(-size)        0
      set option(-min)         0
      set option(-max)         100000
      set option(-allowresize) 1
  
!     tixHandleOptions option {-size -max -min -allowresize} $args
  
      set data($name,size)        $option(-size)
      set data($name,rsize)       $option(-size)
--- 90,102 ----
  
      # The default values
      #
+     set option(-border)      $data(-paneborderwidth)
      set option(-size)        0
      set option(-min)         0
      set option(-max)         100000
      set option(-allowresize) 1
  
!     tixHandleOptions option {-border -size -max -min -allowresize} $args
  
      set data($name,size)        $option(-size)
      set data($name,rsize)       $option(-size)
***************
*** 105,111 ****
  
      # Step 2: Add the frame and the separator (if necessary)
      #
!     frame $w.$name -bd $data(-paneborderwidth) -relief $data(-panerelief)
  
      lappend data(items) $name
      incr data(nItems)
--- 106,112 ----
  
      # Step 2: Add the frame and the separator (if necessary)
      #
!     frame $w.$name -bd $option(-border) -relief $data(-panerelief)
  
      lappend data(items) $name
      incr data(nItems)
***************
*** 149,154 ****
--- 150,178 ----
      }
  
      tixPanedWindow::RepackWhenIdle $w
+ }
+ 
+ proc tixPanedWindow::panename {w name args} {
+     upvar #0 $w data
+ 
+     if {$args == {}} {
+         # return the pathname
+         return $w.$name
+     } else {
+         return [eval $w.$name $args]
+     }
+ }
+ 
+ # return the name of all panes
+ proc tixPanedWindow::panes {w} {
+     upvar #0 $w data
+ 
+     set ret {}
+     foreach name $data(items) {
+         lappend ret $w.$name
+     }
+ 
+     return $ret
  }
  
  #----------------------------------------------------------------------
*** SWidget.tcl.OLD	Fri Jun 30 08:03:13 1995
--- SWidget.tcl	Fri Jun 30 08:03:13 1995
***************
*** 16,24 ****
      -flag {
  	-scrollbar
      }
-     -static {
- 	-scrollbar
-     }
      -configspec {
  	{-scrollbar scrollbar Scrollbar both}
      }
--- 16,21 ----
*** VStack.tcl.OLD	Fri Jun 30 08:03:15 1995
--- VStack.tcl	Fri Jun 30 08:03:15 1995
***************
*** 106,111 ****
--- 106,112 ----
  	tixUnmapWindow $data(w:$data(topchild))
      }
  
+     set oldTopChild $data(topchild)
      set data(topchild) $child
  
      set myW [winfo width  $w]
***************
*** 122,129 ****
  	raise $data(w:$child)
      }
  
!     if {$data($child,raisecmd) != {}} {
! 	eval $data($child,raisecmd)
      }
  }
  
--- 123,132 ----
  	raise $data(w:$child)
      }
  
!     if {$oldTopChild != $child} {
!         if {$data($child,raisecmd) != {}} {
! 	    eval $data($child,raisecmd)
!         }
      }
  }
  

Greetings, Sven



