MCPcopy Create free account
hub / github.com/SimHacker/micropolis / EntryUpdateScrollbar

Function EntryUpdateScrollbar

micropolis-activity/src/tk/tkentry.c:1601–1639  ·  view source on GitHub ↗
(entryPtr)

Source from the content-addressed store, hash-verified

1599 *
1600 * EntryUpdateScrollbar --
1601 *
1602 * This procedure is invoked whenever information has changed in
1603 * an entry in a way that would invalidate a scrollbar display.
1604 * If there is an associated scrollbar, then this command updates
1605 * it by invoking a Tcl command.
1606 *
1607 * Results:
1608 * None.
1609 *
1610 * Side effects:
1611 * A Tcl command is invoked, and an additional command may be
1612 * invoked to process errors in the command.
1613 *
1614 *----------------------------------------------------------------------
1615 */
1616
1617static void
1618EntryUpdateScrollbar(entryPtr)
1619 register Entry *entryPtr; /* Information about widget. */
1620{
1621 char args[100];
1622 int result, last, charsInWindow, endX;
1623
1624 if (entryPtr->scrollCmd == NULL) {
1625 return;
1626 }
1627
1628 /*
1629 * The most painful part here is guessing how many characters
1630 * actually fit in the window. This is only an estimate in the
1631 * case where the window isn't completely filled with characters.
1632 */
1633
1634 charsInWindow = TkMeasureChars(entryPtr->fontPtr,
1635 entryPtr->string + entryPtr->leftIndex,
1636 entryPtr->numChars - entryPtr->leftIndex, entryPtr->offset,
1637 Tk_Width(entryPtr->tkwin),
1638 TK_AT_LEAST_ONE|TK_NEWLINES_NOT_SPECIAL, &endX);
1639 if (charsInWindow == 0) {
1640 last = entryPtr->leftIndex;
1641 } else {
1642 last = entryPtr->leftIndex + charsInWindow - 1;

Callers 7

EntryWidgetCmdFunction · 0.85
ConfigureEntryFunction · 0.85
InsertCharsFunction · 0.85
DeleteCharsFunction · 0.85
EntrySetValueFunction · 0.85
EntryEventProcFunction · 0.85
EntryScanToFunction · 0.85

Calls 4

TkMeasureCharsFunction · 0.85
TkBindErrorFunction · 0.85
Tcl_SetResultFunction · 0.85
Tcl_VarEvalFunction · 0.50

Tested by

no test coverage detected