Tk Library Source Code

Artifact [5b73d0b26c]
Login

Artifact 5b73d0b26cb41b9312538aa8e09db10fb269e69c:

Attachment "None" to ticket [402776ffff] added by stevel 2000-12-11 16:59:50.
Index: entry.tcl
===================================================================
RCS file: /cvsroot/tcllib/bwidget/entry.tcl,v
retrieving revision 1.14
diff -c -r1.14 entry.tcl
*** entry.tcl	2000/04/27 15:39:31	1.14
--- entry.tcl	2000/12/12 07:30:53
***************
*** 17,30 ****
  # ------------------------------------------------------------------------------
  
  namespace eval Entry {
!     Widget::tkinclude Entry entry :cmd \
! 	    remove [list -state -cursor -foreground -textvariable]
      # Note:  -textvariable is pulled off of the tk entry and put onto the
      # BW Entry so that we avoid the TkResource test for it, which screws up
      # the existance/non-existance bits of the -textvariable.
!     Widget::declare Entry [list \
! 	    [list -foreground		TkResource	""	0 entry] \
! 	    [list -disabledforeground	TkResource	""	0 button] \
  	    [list -state	Enum	normal	0 [list normal disabled]] \
  	    [list -text			String	""	0] \
  	    [list -textvariable		String	""	0] \
--- 17,45 ----
  # ------------------------------------------------------------------------------
  
  namespace eval Entry {
!     set remove [list -state -cursor -foreground -textvariable]
!     if {[info tclversion] >= 8.4} {
!         #
!         #   Note that Tk 8.4 introduced the -state normal/disabled entry widget
!         #   option which broke the BWidget Entry widget
!         #
!         lappend remove -disabledforeground -background -disabledbackground
!     }
!     Widget::tkinclude Entry entry :cmd remove $remove
      # Note:  -textvariable is pulled off of the tk entry and put onto the
      # BW Entry so that we avoid the TkResource test for it, which screws up
      # the existance/non-existance bits of the -textvariable.
!     set declare [list [list -foreground		TkResource	""	0 entry]]
!     if {[info tclversion] < 8.4} {
!         lappend declare \
!             [list -disabledforeground		TkResource	""	0 button]
!     } else {
!         lappend declare \
!             [list -background		        TkResource	""	0 entry] \
!             [list -disabledforeground		TkResource	""	0 entry] \
!             [list -disabledbackground		TkResource	""	0 entry]
!     }
!     lappend declare \
  	    [list -state	Enum	normal	0 [list normal disabled]] \
  	    [list -text			String	""	0] \
  	    [list -textvariable		String	""	0] \
***************
*** 33,40 ****
  	    [list -relief		TkResource	""	0 entry] \
  	    [list -borderwidth		TkResource	""	0 entry] \
  	    [list -fg		Synonym		-foreground] \
! 	    [list -bd		Synonym		-borderwidth] \
! 	    ]
      Widget::addmap Entry "" :cmd {-textvariable {}}
  
      DynamicHelp::include Entry balloon
--- 48,57 ----
  	    [list -relief		TkResource	""	0 entry] \
  	    [list -borderwidth		TkResource	""	0 entry] \
  	    [list -fg		Synonym		-foreground] \
! 	    [list -bg		Synonym		-background] \
! 	    [list -bd		Synonym		-borderwidth]
! 
!     Widget::declare Entry $declare
      Widget::addmap Entry "" :cmd {-textvariable {}}
  
      DynamicHelp::include Entry balloon
***************
*** 92,104 ****
      if { $editable == 0 } {
          $path configure -cursor left_ptr
      }
!     if { ![string compare $state "disabled"] } {
!         $path configure -foreground \
! 		[Widget::getMegawidgetOption $path -disabledforeground]
      } else {
! 	$path configure -foreground \
! 		[Widget::getMegawidgetOption $path -foreground]
! 	bindtags $path [linsert [bindtags $path] 2 BwEditableEntry] 
      }
      if { [string length $text] } {
  	set varName [$path cget -textvariable]
--- 109,125 ----
      if { $editable == 0 } {
          $path configure -cursor left_ptr
      }
!     if {[info tclversion] < 8.4} {
!         if { ![string compare $state "disabled"] } {
!             $path configure -foreground \
!                 [Widget::getMegawidgetOption $path -disabledforeground]
!         } else {
!             $path configure -foreground \
!                 [Widget::getMegawidgetOption $path -foreground]
!             bindtags $path [linsert [bindtags $path] 2 BwEditableEntry] 
!         }
      } else {
!         $path configure -state $state
      }
      if { [string length $text] } {
  	set varName [$path cget -textvariable]
***************
*** 135,142 ****
      set res [Widget::configure $path $args]
  
      # Extract the modified bits that we are interested in.
!     foreach {chstate cheditable chfg chdfg chtext} [Widget::hasChangedX $path \
! 	    -state -editable -foreground -disabledforeground -text] break
  
      if { $chstate || $cheditable } {
  	set state [Widget::getMegawidgetOption $path -state]
--- 156,167 ----
      set res [Widget::configure $path $args]
  
      # Extract the modified bits that we are interested in.
!     set opts "-state -editable -foreground -disabledforeground -text"
!     if {[info tclversion] >= 8.4} {
!         append opts " -background -disabledbackground"
!     }
!     foreach {chstate cheditable chfg chdfg chtext} \
!         [eval Widget::hasChangedX $path $opts] break
  
      if { $chstate || $cheditable } {
  	set state [Widget::getMegawidgetOption $path -state]
***************
*** 162,173 ****
  
      if { $chstate || $chfg || $chdfg } {
  	set state [Widget::getMegawidgetOption $path -state]
!         if { ![string compare $state "disabled"] } {
! 	    set dfg [Widget::cget $path -disabledforeground]
!             $path:cmd configure -fg $dfg
          } else {
! 	    set fg [Widget::cget $path -foreground]
!             $path:cmd configure -fg $fg
          }
      }
      if { $chstate } {
--- 187,202 ----
  
      if { $chstate || $chfg || $chdfg } {
  	set state [Widget::getMegawidgetOption $path -state]
!         if {[info tclversion] < 8.4} {
!             if { ![string compare $state "disabled"] } {
!                 set dfg [Widget::cget $path -disabledforeground]
!                 $path:cmd configure -fg $dfg
!             } else {
!                 set fg [Widget::cget $path -foreground]
!                 $path:cmd configure -fg $fg
!             }
          } else {
!             $path:cmd configure -state $state
          }
      }
      if { $chstate } {