Tk_CanvasTextInfo(3)
β¨ NAME β¨
okay so Tk_CanvasTextInfo β it's the extra-info situation for managing text items in canvases. That's the whole name vibe: additional information for managing text items in canvases. We're in the Tk Library Procedures manual, bestie, and this page is Tk_CanvasTextInfo(3).
π«Ά SYNOPSIS π«Ά
#include <tk.h>
Tk_CanvasTextInfo *
Tk_CanvasGetTextInfo(canvas)
π ARGUMENTS π
Tk_Canvas canvas(in) β a token that identifies a particular canvas widget. That's it, that's the arg π
π¦ DESCRIPTION π¦
Textual canvas items are somewhat more complicated to manage than other items, because of stuff like the selection and the input focus. Tk_CanvasGetTextInfo may be invoked by a type manager to get the additional information needed for items that display text. The return value from Tk_CanvasGetTextInfo is a pointer to a structure that is shared between Tk and all the items that display text. The structure has this form:
typedef struct {
Tk_3DBorder selBorder;
int selBorderWidth;
XColor *selFgColorPtr;
Tk_Item *selItemPtr;
Tcl_Size selectFirst;
Tcl_Size selectLast;
Tk_Item *anchorItemPtr;
Tcl_Size selectAnchor;
Tk_3DBorder insertBorder;
int insertWidth;
int insertBorderWidth;
Tk_Item *focusItemPtr;
int gotFocus;
int cursorOn;
} Tk_CanvasTextInfo;
Here's the field-by-field tea, no cap:
selBorderβ identifies aTk_3DBorderthat should be used for drawing the background under selected text.selBorderWidthβ gives the width of the raised border around selected text, in pixels.selFgColorPtrβ points to anXColorthat describes the foreground color to be used when drawing selected text.selItemPtrβ points to the item that is currently selected, orNULLif there is no item selected or if the canvas does not have the selection.selectFirstandselectLastβ give the indices of the first and last selected characters inselItemPtr, as returned by theindexProcfor that item.anchorItemPtrβ points to the item that currently has the selection anchor; this is not necessarily the same asselItemPtr.selectAnchorβ an index that identifies the anchor position withinanchorItemPtr.insertBorderβ contains aTk_3DBorderto use when drawing the insertion cursor.insertWidthβ gives the total width of the insertion cursor in pixels.insertBorderWidthβ gives the width of the raised border around the insertion cursor.focusItemPtrβ identifies the item that currently has the input focus, orNULLif there is no such item.gotFocusβ is1if the canvas widget has the input focus and0otherwise.cursorOnβ is1if the insertion cursor should be drawn infocusItemPtrand0if it should not be drawn; this field is toggled on and off by Tk to make the cursor blink.
The structure returned by Tk_CanvasGetTextInfo is shared between Tk and the type managers; typically the type manager calls Tk_CanvasGetTextInfo once when an item is created and then saves the pointer in the item's record. Tk will update information in the Tk_CanvasTextInfo; for example, a configure widget command might change the selBorder field, or a select widget command might change the selectFirst field, or Tk might change cursorOn in order to make the insertion cursor flash on and off during successive redisplays.
Type managers should treat all of the fields of theTk_CanvasTextInfostructure as read-only, except forselItemPtr,selectFirst,selectLast, andselectAnchor. Type managers may changeselectFirst,selectLast, andselectAnchorto adjust for insertions and deletions in the item (but only if the item is the current owner of the selection or anchor, as determined byselItemPtroranchorItemPtr). If all of the selected text in the item is deleted, the item should setselItemPtrtoNULLto indicate that there is no longer a selection.
π KEYWORDS π
canvas, focus, insertion cursor, selection, selection anchor, text
okay that's the page, bestie π source/version is Tk 4.0, the manual page is Tk_CanvasTextInfo(3), and the date spot isn't printed in this footer, so we're not making one up πβ¨
π¦ where this page comes from
- alpine 3.23: tk9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tk9-doc 9.0.3-r2 Β· TCL
- fedora 43: tk-devel 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 43: tk-devel 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk-devel 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk-devel 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- nixos 26.05: tk 9.0.3
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms