summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorericm <ericm>2000-05-14 20:45:36 (GMT)
committerericm <ericm>2000-05-14 20:45:36 (GMT)
commitfb29a6c87e4505a9ba03eaad1248cecd64640960 (patch)
tree37a41246252550f624c788dc529937a909684f60
parentbfa082e9202bf219a84a4bb0d997d6cf1f834516 (diff)
downloadtk-fb29a6c87e4505a9ba03eaad1248cecd64640960.zip
tk-fb29a6c87e4505a9ba03eaad1248cecd64640960.tar.gz
tk-fb29a6c87e4505a9ba03eaad1248cecd64640960.tar.bz2
* library/entry.tcl: Adjusted Button-1 binding to set focus to the
entry when it is readonly or normal. * doc/entry.n: Added documentation for readonly state, -disabledforeground, -disabledbackground. * tests/entry.test: Added tests for readonly state. * generic/tkEntry.c: Added support for "readonly" state, and redefined "disabled" state. A disabled entry will display its text in a dimmed color and possibly with a different background, and will be completely unusable (no selection, no editing). A readonly entry will look like a normal entry, but it will not be editable; selection is still allowed. [RFE: 4239]. To support the new disabled state properly, "-disabledforeground" and "-disabledbackground" options were added. *** THIS IS A BACKWARDS INCOMPATIBLE BEHAVIOR CHANGE *** * win/tkWinDefault.h: * mac/tkMacDefault.h: * unix/tkUnixDefault.h: Added DEF_ENTRY_DISABLED_FG, DEF_ENTRY_DISABLED_BG_COLOR, DEF_ENTRY_DISABLED_BG_MONO.
-rw-r--r--ChangeLog25
-rw-r--r--doc/entry.n39
-rw-r--r--generic/tkEntry.c102
-rw-r--r--library/entry.tcl4
-rw-r--r--mac/tkMacDefault.h5
-rw-r--r--tests/entry.test47
-rw-r--r--unix/tkUnixDefault.h6
-rw-r--r--win/tkWinDefault.h5
8 files changed, 194 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index e8180f2..833efca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2000-05-14 Eric Melski <ericm@scriptics.com>
+
+ * library/entry.tcl: Adjusted Button-1 binding to set focus to the
+ entry when it is readonly or normal.
+
+ * doc/entry.n: Added documentation for readonly state,
+ -disabledforeground, -disabledbackground.
+
+ * tests/entry.test: Added tests for readonly state.
+
+ * generic/tkEntry.c: Added support for "readonly" state, and
+ redefined "disabled" state. A disabled entry will display its
+ text in a dimmed color and possibly with a different background,
+ and will be completely unusable (no selection, no editing). A
+ readonly entry will look like a normal entry, but it will not be
+ editable; selection is still allowed. [RFE: 4239]. To support the
+ new disabled state properly, "-disabledforeground" and
+ "-disabledbackground" options were added.
+ *** THIS IS A BACKWARDS INCOMPATIBLE BEHAVIOR CHANGE ***
+
+ * win/tkWinDefault.h:
+ * mac/tkMacDefault.h:
+ * unix/tkUnixDefault.h: Added DEF_ENTRY_DISABLED_FG,
+ DEF_ENTRY_DISABLED_BG_COLOR, DEF_ENTRY_DISABLED_BG_MONO.
+
2000-05-12 Eric Melski <ericm@scriptics.com>
* unix/tkUnixButton.c (TkpDisplayButton, TkpComputeButtonGeometry):
diff --git a/doc/entry.n b/doc/entry.n
index ee76524..474e2a2 100644
--- a/doc/entry.n
+++ b/doc/entry.n
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: entry.n,v 1.4 2000/03/02 21:53:01 hobbs Exp $
+'\" RCS: @(#) $Id: entry.n,v 1.5 2000/05/14 20:45:37 ericm Exp $
'\"
.so man.macros
.TH entry n 8.3 Tk "Tk Built-In Commands"
@@ -17,14 +17,24 @@ entry \- Create and manipulate entry widgets
.SH SYNOPSIS
\fBentry\fR \fIpathName \fR?\fIoptions\fR?
.SO
-\-background \-highlightbackground \-insertontime \-selectforeground
-\-borderwidth \-highlightcolor \-insertwidth \-takefocus
-\-cursor \-highlightthickness \-justify \-textvariable
-\-exportselection \-insertbackground \-relief \-xscrollcommand
-\-font \-insertborderwidth \-selectbackground
-\-foreground \-insertofftime \-selectborderwidth
+\-background \-highlightthickness \-selectbackground
+\-borderwidth \-insertbackground \-selectborderwidth
+\-cursor \-insertborderwidth \-selectforeground
+\-exportselection \-insertofftime \-takefocus
+\-font \-insertontime \-textvariable
+\-foreground \-insertwidth \-xscrollcommand
+\-highlightbackground \-justify
+\-highlightcolor \-relief
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
+.VS 8.4
+.OP \-disabledbackground disabledBackground DisabledBackground
+Specifies the background color to use when the entry is disabled. If
+this option is the empty string, the normal background color is used.
+.OP \-disabledforeground disabledForeground DisabledForeground
+Specifies the foreground color to use when the entry is disabled. If
+this option is the empty string, the normal foreground color is used.
+.VE 8.4
.VS 8.3
.OP "\-invalidcommand or \-invcmd" invalidCommand InvalidCommand
Specifies a script to eval when \fBvalidateCommand\fR returns 0.
@@ -42,11 +52,18 @@ a password.
If characters in the entry are selected and copied elsewhere, the
information copied will be what is displayed, not the true contents
of the entry.
+.VS 8.4
.OP \-state state State
-Specifies one of two states for the entry: \fBnormal\fR or \fBdisabled\fR.
-If the entry is disabled then the value may not be changed using widget
-commands and no insertion cursor will be displayed, even if the input focus is
-in the widget.
+Specifies one of three states for the entry: \fBnormal\fR,
+\fBdisabled\fR, or \fBreadonly\fR. If the entry is readonly, then the
+value may not be changed using widget commands and no insertion cursor
+will be displayed, even if the input focus is in the widget; the
+contents of the widget may still be selected. If the entry is
+disabled, the value may not be changed, no insertion cursor will be
+displayed, the contents will not be selectable, and the entry may
+be displayed in a different color, depending on the values of the
+\fB-disabledforeground\fR and \fB-disabledbackground\fR options.
+.VE 8.4
.VS 8.3
.OP \-validate validate Validate
Specifies the mode in which validation should operate: \fBnone\fR,
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 21d2a46..b14da83 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkEntry.c,v 1.14 2000/04/21 04:06:26 hobbs Exp $
+ * RCS: @(#) $Id: tkEntry.c,v 1.15 2000/05/14 20:45:37 ericm Exp $
*/
#include "tkInt.h"
@@ -72,12 +72,16 @@ typedef struct {
Tk_3DBorder normalBorder; /* Used for drawing border around whole
* window, plus used for background. */
+ Tk_3DBorder disabledBorder; /* Used for drawing border around whole
+ * window in disabled state, plus used for
+ * background. */
int borderWidth; /* Width of 3-D border around window. */
Tk_Cursor cursor; /* Current cursor for window, or None. */
int exportSelection; /* Non-zero means tie internal entry selection
* to X selection. */
Tk_Font tkfont; /* Information about text font, or NULL. */
XColor *fgColorPtr; /* Text color in normal mode. */
+ XColor *dfgColorPtr; /* Text color in disabled mode. */
XColor *highlightBgColorPtr;/* Color for drawing traversal highlight
* area when highlight is off. */
XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
@@ -146,6 +150,7 @@ typedef struct {
/* Timer handler used to blink cursor on and
* off. */
GC textGC; /* For drawing normal text. */
+ GC disabledTextGC; /* For drawing disabled text. */
GC selTextGC; /* For drawing selected text. */
GC highlightGC; /* For drawing traversal highlight. */
int avgWidth; /* Width of average character. */
@@ -211,11 +216,11 @@ typedef struct {
*/
enum state {
- STATE_DISABLED, STATE_NORMAL
+ STATE_DISABLED, STATE_NORMAL, STATE_READONLY
};
static char *stateStrings[] = {
- "disabled", "normal", (char *) NULL
+ "disabled", "normal", "readonly", (char *) NULL
};
/*
@@ -254,6 +259,13 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_ENTRY_CURSOR, -1, Tk_Offset(Entry, cursor),
TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_BORDER, "-disabledbackground", "disabledBackground",
+ "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, -1,
+ Tk_Offset(Entry, disabledBorder), TK_OPTION_NULL_OK,
+ (ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0},
+ {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
+ "DisabledForeground", DEF_ENTRY_DISABLED_FG, -1,
+ Tk_Offset(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
"ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1,
Tk_Offset(Entry, exportSelection), 0, 0, 0},
@@ -521,11 +533,13 @@ Tk_EntryObjCmd(clientData, interp, objc, objv)
entryPtr->scanMarkIndex = 0;
entryPtr->normalBorder = NULL;
+ entryPtr->disabledBorder = NULL;
entryPtr->borderWidth = 0;
entryPtr->cursor = None;
entryPtr->exportSelection = 1;
entryPtr->tkfont = NULL;
entryPtr->fgColorPtr = NULL;
+ entryPtr->dfgColorPtr = NULL;
entryPtr->highlightBgColorPtr = NULL;
entryPtr->highlightColorPtr = NULL;
entryPtr->highlightWidth = 0;
@@ -557,6 +571,7 @@ Tk_EntryObjCmd(clientData, interp, objc, objv)
entryPtr->leftIndex = 0;
entryPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
entryPtr->textGC = None;
+ entryPtr->disabledTextGC = None;
entryPtr->selTextGC = None;
entryPtr->highlightGC = None;
entryPtr->avgWidth = 1;
@@ -799,21 +814,29 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
int index, index2;
if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "option ?index?");
+ Tcl_WrongNumArgs(interp, 2, objv, "option ?index?");
goto error;
}
-
+
/*
* Parse the selection sub-command, using the command
* table "selCommandNames" defined above.
*/
result = Tcl_GetIndexFromObj(interp, objv[2], selCommandNames,
- "selection option", 0, &selIndex);
+ "selection option", 0, &selIndex);
if (result != TCL_OK) {
- goto error;
+ goto error;
}
+
+ /*
+ * Disabled entries don't allow the selection to be modified.
+ */
+ if (entryPtr->state == STATE_DISABLED) {
+ goto done;
+ }
+
switch(selIndex) {
case SELECTION_ADJUST: {
if (objc != 4) {
@@ -1065,6 +1088,9 @@ DestroyEntry(memPtr)
if (entryPtr->textGC != None) {
Tk_FreeGC(entryPtr->display, entryPtr->textGC);
}
+ if (entryPtr->disabledTextGC != None) {
+ Tk_FreeGC(entryPtr->display, entryPtr->disabledTextGC);
+ }
if (entryPtr->selTextGC != None) {
Tk_FreeGC(entryPtr->display, entryPtr->selTextGC);
}
@@ -1111,6 +1137,7 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
{
Tk_SavedOptions savedOptions;
Tcl_Obj *errorResult = NULL;
+ Tk_3DBorder border;
int error;
int oldExport;
@@ -1152,7 +1179,13 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
* the geometry and setting the background from a 3-D border.
*/
- Tk_SetBackgroundFromBorder(entryPtr->tkwin, entryPtr->normalBorder);
+ if (entryPtr->state == STATE_DISABLED &&
+ entryPtr->disabledBorder != NULL) {
+ border = entryPtr->disabledBorder;
+ } else {
+ border = entryPtr->normalBorder;
+ }
+ Tk_SetBackgroundFromBorder(entryPtr->tkwin, border);
if (entryPtr->insertWidth <= 0) {
entryPtr->insertWidth = 2;
@@ -1268,7 +1301,10 @@ EntryWorldChanged(instanceData)
entryPtr->avgWidth = 1;
}
- if (entryPtr->normalBorder != NULL) {
+ if (entryPtr->state == STATE_DISABLED &&
+ entryPtr->disabledBorder != NULL) {
+ Tk_SetBackgroundFromBorder(entryPtr->tkwin, entryPtr->disabledBorder);
+ } else if (entryPtr->normalBorder != NULL) {
Tk_SetBackgroundFromBorder(entryPtr->tkwin, entryPtr->normalBorder);
}
@@ -1291,6 +1327,20 @@ EntryWorldChanged(instanceData)
}
entryPtr->selTextGC = gc;
+ if (entryPtr->dfgColorPtr != NULL) {
+ gcValues.foreground = entryPtr->dfgColorPtr->pixel;
+ gcValues.font = Tk_FontId(entryPtr->tkfont);
+ gcValues.graphics_exposures = False;
+ mask = GCForeground | GCFont | GCGraphicsExposures;
+ gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues);
+ } else {
+ gc = None;
+ }
+ if (entryPtr->disabledTextGC != None) {
+ Tk_FreeGC(entryPtr->display, entryPtr->disabledTextGC);
+ }
+ entryPtr->disabledTextGC = gc;
+
/*
* Recompute the window's geometry and arrange for it to be
* redisplayed.
@@ -1328,7 +1378,9 @@ DisplayEntry(clientData)
Tk_FontMetrics fm;
Pixmap pixmap;
int showSelection;
-
+ GC textGC;
+ Tk_3DBorder border;
+
entryPtr->flags &= ~REDRAW_PENDING;
if ((entryPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
return;
@@ -1380,10 +1432,16 @@ DisplayEntry(clientData)
* insertion cursor background.
*/
- Tk_Fill3DRectangle(tkwin, pixmap, entryPtr->normalBorder,
- 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
+ if (entryPtr->state == STATE_DISABLED &&
+ entryPtr->disabledBorder != NULL) {
+ border = entryPtr->disabledBorder;
+ } else {
+ border = entryPtr->normalBorder;
+ }
+ Tk_Fill3DRectangle(tkwin, pixmap, border,
+ 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
- if (showSelection
+ if (showSelection && entryPtr->state != STATE_DISABLED
&& (entryPtr->selectLast > entryPtr->leftIndex)) {
if (entryPtr->selectFirst <= entryPtr->leftIndex) {
selStartX = entryPtr->leftX;
@@ -1428,7 +1486,7 @@ DisplayEntry(clientData)
fm.ascent + fm.descent, entryPtr->insertBorderWidth,
TK_RELIEF_RAISED);
} else if (entryPtr->insertBorder == entryPtr->selBorder) {
- Tk_Fill3DRectangle(tkwin, pixmap, entryPtr->normalBorder,
+ Tk_Fill3DRectangle(tkwin, pixmap, border,
cursorX, baseY - fm.ascent, entryPtr->insertWidth,
fm.ascent + fm.descent, 0, TK_RELIEF_FLAT);
}
@@ -1440,12 +1498,17 @@ DisplayEntry(clientData)
* selected portion on top of it.
*/
- Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ if (entryPtr->state == STATE_DISABLED && entryPtr->dfgColorPtr != NULL) {
+ textGC = entryPtr->disabledTextGC;
+ } else {
+ textGC = entryPtr->textGC;
+ }
+ Tk_DrawTextLayout(entryPtr->display, pixmap, textGC,
entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
entryPtr->leftIndex, entryPtr->numChars);
- if (showSelection
- && (entryPtr->selTextGC != entryPtr->textGC)
+ if (showSelection && entryPtr->state != STATE_DISABLED
+ && (entryPtr->selTextGC != textGC)
&& (entryPtr->selectFirst < entryPtr->selectLast)) {
int selFirst;
@@ -1465,7 +1528,7 @@ DisplayEntry(clientData)
*/
if (entryPtr->relief != TK_RELIEF_FLAT) {
- Tk_Draw3DRectangle(tkwin, pixmap, entryPtr->normalBorder,
+ Tk_Draw3DRectangle(tkwin, pixmap, border,
entryPtr->highlightWidth, entryPtr->highlightWidth,
Tk_Width(tkwin) - 2 * entryPtr->highlightWidth,
Tk_Height(tkwin) - 2 * entryPtr->highlightWidth,
@@ -1490,7 +1553,7 @@ DisplayEntry(clientData)
* and free up the pixmap.
*/
- XCopyArea(entryPtr->display, pixmap, Tk_WindowId(tkwin), entryPtr->textGC,
+ XCopyArea(entryPtr->display, pixmap, Tk_WindowId(tkwin), textGC,
0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin),
0, 0);
Tk_FreePixmap(entryPtr->display, pixmap);
@@ -2569,6 +2632,7 @@ EntryBlinkProc(clientData)
Entry *entryPtr = (Entry *) clientData;
if ((entryPtr->state == STATE_DISABLED) ||
+ (entryPtr->state == STATE_READONLY) ||
!(entryPtr->flags & GOT_FOCUS) || (entryPtr->insertOffTime == 0)) {
return;
}
diff --git a/library/entry.tcl b/library/entry.tcl
index 9e51397..a46561e 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -3,7 +3,7 @@
# This file defines the default bindings for Tk entry widgets and provides
# procedures that help in implementing those bindings.
#
-# RCS: @(#) $Id: entry.tcl,v 1.11 2000/01/06 02:22:24 hobbs Exp $
+# RCS: @(#) $Id: entry.tcl,v 1.12 2000/05/14 20:45:38 ericm Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -336,7 +336,7 @@ proc tkEntryButton1 {w x} {
set tkPriv(pressX) $x
$w icursor [tkEntryClosestGap $w $x]
$w selection from insert
- if {[string equal [$w cget -state] "normal"]} {focus $w}
+ if {[string compare [$w cget -state] "disabled"]} {focus $w}
}
# tkEntryMouseSelect --
diff --git a/mac/tkMacDefault.h b/mac/tkMacDefault.h
index e37bafe..1d7f010 100644
--- a/mac/tkMacDefault.h
+++ b/mac/tkMacDefault.h
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacDefault.h,v 1.5 2000/05/13 00:39:08 ericm Exp $
+ * RCS: @(#) $Id: tkMacDefault.h,v 1.6 2000/05/14 20:45:38 ericm Exp $
*/
#ifndef _TKMACDEFAULT
@@ -139,6 +139,9 @@
/* #define DEF_ENTRY_BORDER_WIDTH "2" */
#define DEF_ENTRY_BORDER_WIDTH "1"
#define DEF_ENTRY_CURSOR "xterm"
+#define DEF_ENTRY_DISABLED_BG_COLOR NORMAL_BG
+#define DEF_ENTRY_DISABLED_BG_MONO WHITE
+#define DEF_ENTRY_DISABLED_FG DISABLED
#define DEF_ENTRY_EXPORT_SELECTION "1"
#define DEF_ENTRY_FONT "Helvetica 12"
#define DEF_ENTRY_FG BLACK
diff --git a/tests/entry.test b/tests/entry.test
index f8fd7ef..10178da 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: entry.test,v 1.7 2000/03/07 22:27:50 hobbs Exp $
+# RCS: @(#) $Id: entry.test,v 1.8 2000/05/14 20:45:38 ericm Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
@@ -55,11 +55,15 @@ update
set i 1
foreach test {
{-background #ff0000 #ff0000 non-existent
- {unknown color name "non-existent"}}
+ {unknown color name "non-existent"}}
{-bd 4 4 badValue {bad screen distance "badValue"}}
{-bg #ff0000 #ff0000 non-existent {unknown color name "non-existent"}}
{-borderwidth 1.3 1 badValue {bad screen distance "badValue"}}
{-cursor arrow arrow badValue {bad cursor spec "badValue"}}
+ {-disabledbackground green green non-existent
+ {unknown color name "non-existent"}}
+ {-disabledforeground blue blue non-existent
+ {unknown color name "non-existent"}}
{-exportselection yes 1 xyzzy {expected boolean value but got "xyzzy"}}
{-fg #110022 #110022 bogus {unknown color name "bogus"}}
{-font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
@@ -80,7 +84,8 @@ foreach test {
{-selectborderwidth 1.3 1 badValue {bad screen distance "badValue"}}
{-selectforeground #654321 #654321 bogus {unknown color name "bogus"}}
{-show * * {} {}}
- {-state n normal bogus {bad state "bogus": must be disabled or normal}}
+ {-state n normal bogus
+ {bad state "bogus": must be disabled, normal, or readonly}}
{-takefocus "any string" "any string" {} {}}
{-textvariable i i {} {}}
{-width 402 402 3p {expected integer but got "3p"}}
@@ -191,7 +196,7 @@ test entry-3.14 {EntryWidgetCmd procedure, "cget" widget command} {
} {4}
test entry-3.15 {EntryWidgetCmd procedure, "configure" widget command} {
llength [.e configure]
-} {33}
+} {35}
test entry-3.16 {EntryWidgetCmd procedure, "configure" widget command} {
list [catch {.e configure -foo} msg] $msg
} {1 {unknown option "-foo"}}
@@ -254,6 +259,14 @@ test entry-3.26 {EntryWidgetCmd procedure, "delete" widget command} {
.e configure -state normal
.e get
} {01234567890}
+test entry-3.27 {EntryWidgetCmd procedure, "delete" widget command} {
+ .e delete 0 end
+ .e insert end "01234567890"
+ .e configure -state readonly
+ .e delete 2 8
+ .e configure -state normal
+ .e get
+} {01234567890}
test entry-3.27 {EntryWidgetCmd procedure, "get" widget command} {
list [catch {.e get foo} msg] $msg
} {1 {wrong # args: should be ".e get"}}
@@ -310,6 +323,14 @@ test entry-3.40 {EntryWidgetCmd procedure, "insert" widget command} {
.e configure -state normal
.e get
} {01234567890}
+test entry-3.40 {EntryWidgetCmd procedure, "insert" widget command} {
+ .e delete 0 end
+ .e insert end "01234567890"
+ .e configure -state readonly
+ .e insert 3 xxx
+ .e configure -state normal
+ .e get
+} {01234567890}
test entry-3.41 {EntryWidgetCmd procedure, "insert" widget command} {
list [catch {.e insert a b c} msg] $msg
} {1 {wrong # args: should be ".e insert index text"}}
@@ -430,6 +451,24 @@ test entry-3.63 {EntryWidgetCmd procedure, "selection range" widget command} {
.e select range 2 9
list [.e index sel.first] [.e index sel.last] [.e index anchor]
} {2 9 3}
+test entry-3.64 {EntryWidgetCmd procedure, "selection" widget command} {
+ .e delete 0 end
+ .e insert end 0123456789
+ .e selection range 0 end
+ .e configure -state disabled
+ .e selection range 2 4
+ .e configure -state normal
+ list [.e index sel.first] [.e index sel.last]
+} {0 10}
+test entry-3.64 {EntryWidgetCmd procedure, "selection" widget command} {
+ .e delete 0 end
+ .e insert end 0123456789
+ .e selection range 0 end
+ .e configure -state readonly
+ .e selection range 2 4
+ .e configure -state normal
+ list [.e index sel.first] [.e index sel.last]
+} {2 4}
.e delete 0 end
.e insert end "This is quite a long text string, so long that it "
.e insert end "runs off the end of the window quite a bit."
diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h
index 02f1d99..345b943 100644
--- a/unix/tkUnixDefault.h
+++ b/unix/tkUnixDefault.h
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixDefault.h,v 1.5 2000/05/13 00:39:09 ericm Exp $
+ * RCS: @(#) $Id: tkUnixDefault.h,v 1.6 2000/05/14 20:45:39 ericm Exp $
*/
#ifndef _TKUNIXDEFAULT
@@ -136,6 +136,9 @@
#define DEF_ENTRY_BG_MONO WHITE
#define DEF_ENTRY_BORDER_WIDTH "2"
#define DEF_ENTRY_CURSOR "xterm"
+#define DEF_ENTRY_DISABLED_BG_COLOR NORMAL_BG
+#define DEF_ENTRY_DISABLED_BG_MONO WHITE
+#define DEF_ENTRY_DISABLED_FG DISABLED
#define DEF_ENTRY_EXPORT_SELECTION "1"
#define DEF_ENTRY_FONT "Helvetica -12"
#define DEF_ENTRY_FG BLACK
@@ -178,6 +181,7 @@
#define DEF_FRAME_HIGHLIGHT_BG NORMAL_BG
#define DEF_FRAME_HIGHLIGHT BLACK
#define DEF_FRAME_HIGHLIGHT_WIDTH "0"
+#define DEF_FRAME_LABEL ""
#define DEF_FRAME_RELIEF "flat"
#define DEF_FRAME_TAKE_FOCUS "0"
#define DEF_FRAME_USE ""
diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h
index cac2d71..79a1771 100644
--- a/win/tkWinDefault.h
+++ b/win/tkWinDefault.h
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinDefault.h,v 1.5 2000/05/13 00:39:09 ericm Exp $
+ * RCS: @(#) $Id: tkWinDefault.h,v 1.6 2000/05/14 20:45:39 ericm Exp $
*/
#ifndef _TKWINDEFAULT
@@ -142,6 +142,9 @@
#define DEF_ENTRY_BG_MONO WHITE
#define DEF_ENTRY_BORDER_WIDTH "2"
#define DEF_ENTRY_CURSOR "xterm"
+#define DEF_ENTRY_DISABLED_BG_COLOR "SystemButtonFace"
+#define DEF_ENTRY_DISABLED_BG_MONO WHITE
+#define DEF_ENTRY_DISABLED_FG DISABLED
#define DEF_ENTRY_EXPORT_SELECTION "1"
#define DEF_ENTRY_FONT CTL_FONT
#define DEF_ENTRY_FG TEXT_FG