This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Variable pop-up menu bug in Tk


Hi,

I've committed the following patch, which works around a bug in Tk which
can be easily seen on Win98 and Win2000. Open a watch window and add
someting to it. Now try to remove the item from the window using the
right-click popup: the "Remove" item is in the menu, but it cannot be
selected.

Keith

ChangeLog:
2001-05-22  Keith Seitz  <keiths@cygnus.com>

	* library/variables.tcl (postMenu): Add mysterious workaround
	for popup menu bug in Tk for windows.
	Highlight the selection, too.

Patch:
Index: variables.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/variables.tcl,v
retrieving revision 1.8
diff -u -p -r1.8 variables.tcl
--- variables.tcl	2001/04/17 16:14:23	1.8
+++ variables.tcl	2001/05/22 15:45:29
@@ -340,6 +340,9 @@ class VariableWin {

 	set variable [getEntry $X $Y]
 	if {[string length $variable] > 0} {
+	  # First things first: highlight the variable we just selected
+	  $Hlist selection set $variable
+
 	    # Configure menu items
 	    # the title is always first..
 	    #set labelIndex [$Popup index "dummy"]
@@ -374,6 +377,16 @@ class VariableWin {
 		debug "configuring entry $i ([$ViewMenu entrycget $i -label]) to $fmt"
 		$ViewMenu entryconfigure $i \
 		    -command "$this setDisplay \{$variable\} $fmt"
+	    }
+
+	    if {$::tcl_platform(platform) == "windows"} {
+	      # Don't ask me why this works, but it does work around
+	      # a Win98/2000 Tcl bug with deleting entries from popups...
+	      set no [$Popup index end]
+	      for { set k 1 } { $k < $no } { incr k } {
+		$Popup insert 1 command
+	      }
+	      $Popup delete 1 [expr {$no - 1}]
 	    }

 	    tk_popup $Popup $X $Y


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]