summaryrefslogtreecommitdiffstats
path: root/generic/ttk/ttkEntry.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/ttk/ttkEntry.c')
-rw-r--r--generic/ttk/ttkEntry.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index ae43ae6..f395649 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -652,7 +652,7 @@ static void EntryRevalidateBG(Entry *entryPtr, VREASON reason)
{
Tcl_Interp *interp = entryPtr->core.interp;
if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) {
- Tcl_BackgroundError(interp);
+ Tcl_BackgroundException(interp, TCL_ERROR);
}
}
@@ -758,8 +758,8 @@ static int EntrySetValue(Entry *entryPtr, const char *value)
Tcl_GetString(entryPtr->entry.textVariableObj);
if (textVarName && *textVarName) {
entryPtr->core.flags |= SYNCING_VARIABLE;
- value = Tcl_SetVar(entryPtr->core.interp, textVarName,
- value, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG);
+ value = Tcl_SetVar2(entryPtr->core.interp, textVarName,
+ NULL, value, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG);
entryPtr->core.flags &= ~SYNCING_VARIABLE;
if (!value || WidgetDestroyed(&entryPtr->core)) {
return TCL_ERROR;
@@ -786,7 +786,7 @@ static void EntryTextVariableTrace(void *recordPtr, const char *value)
}
if (entryPtr->core.flags & SYNCING_VARIABLE) {
- /* Trace was fired due to Tcl_SetVar call in EntrySetValue.
+ /* Trace was fired due to Tcl_SetVar2 call in EntrySetValue.
* Don't do anything.
*/
return;
@@ -1179,13 +1179,13 @@ static void EntryDisplay(void *clientData, Drawable d)
textarea = Ttk_ClientRegion(entryPtr->core.layout, "textarea");
showCursor =
- (entryPtr->core.flags & CURSOR_ON) != 0
+ (entryPtr->core.flags & CURSOR_ON)
&& EntryEditable(entryPtr)
&& entryPtr->entry.insertPos >= leftIndex
&& entryPtr->entry.insertPos <= rightIndex
;
showSelection =
- (entryPtr->core.state & TTK_STATE_DISABLED) == 0
+ !(entryPtr->core.state & TTK_STATE_DISABLED)
&& selFirst > -1
&& selLast > leftIndex
&& selFirst <= rightIndex
@@ -1314,8 +1314,8 @@ EntryIndex(
int *indexPtr) /* Return value */
{
# define EntryWidth(e) (Tk_Width(entryPtr->core.tkwin)) /* Not Right */
- int length;
- const char *string = Tcl_GetStringFromObj(indexObj, &length);
+ const char *string = Tcl_GetString(indexObj);
+ size_t length = indexObj->length;
if (strncmp(string, "end", length) == 0) {
*indexPtr = entryPtr->entry.numChars;
@@ -1327,9 +1327,10 @@ EntryIndex(
*indexPtr = entryPtr->entry.xscroll.last;
} else if (strncmp(string, "sel.", 4) == 0) {
if (entryPtr->entry.selectFirst < 0) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "selection isn't in widget ",
- Tk_PathName(entryPtr->core.tkwin), NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "selection isn't in widget %s",
+ Tk_PathName(entryPtr->core.tkwin)));
+ Tcl_SetErrorCode(interp, "TTK", "ENTRY", "NO_SELECTION", NULL);
return TCL_ERROR;
}
if (strncmp(string, "sel.first", length) == 0) {
@@ -1381,8 +1382,9 @@ EntryIndex(
return TCL_OK;
badIndex:
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "bad entry index \"", string, "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "bad entry index \"%s\"", string));
+ Tcl_SetErrorCode(interp, "TTK", "ENTRY", "INDEX", NULL);
return TCL_ERROR;
}
@@ -1457,7 +1459,7 @@ EntryGetCommand(
Tcl_WrongNumArgs(interp, 2, objv, NULL);
return TCL_ERROR;
}
- Tcl_SetResult(interp, entryPtr->entry.string, TCL_VOLATILE);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->entry.string, -1));
return TCL_OK;
}
@@ -1795,9 +1797,9 @@ static int ComboboxCurrentCommand(
return TCL_ERROR;
}
if (currentIndex < 0 || currentIndex >= nValues) {
- Tcl_AppendResult(interp,
- "Index ", Tcl_GetString(objv[2]), " out of range",
- NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Index %s out of range", Tcl_GetString(objv[2])));
+ Tcl_SetErrorCode(interp, "TTK", "COMBOBOX", "IDX_RANGE", NULL);
return TCL_ERROR;
}