1Tk_GetAnchorFromObj(3) Tk Library Procedures Tk_GetAnchorFromObj(3)
2
3
4
5______________________________________________________________________________
6
8 Tk_GetAnchorFromObj, Tk_GetAnchor, Tk_NameOfAnchor - translate between
9 strings and anchor positions
10
12 #include <tk.h>
13
14 int │
15 Tk_GetAnchorFromObj(interp, objPtr, anchorPtr) │
16
17 int
18 Tk_GetAnchor(interp, string, anchorPtr)
19
20 CONST char *
21 Tk_NameOfAnchor(anchor)
22
24 Tcl_Interp *interp (in) Interpreter to use for error report‐
25 ing, or NULL.
26
27 Tcl_Obj *objPtr (in/out) │
28 String value contains name of anchor │
29 point: n, ne, e, se, s, sw, w, nw, │
30 or center; internal rep will be mod‐ │
31 ified to cache corresponding │
32 Tk_Anchor. │
33
34 CONST char *string (in) │
35 Same as objPtr except description of │
36 anchor point is passed as a string.
37
38 int *anchorPtr (out) Pointer to location in which to
39 store anchor position corresponding
40 to objPtr or string.
41
42 Tk_Anchor anchor (in) Anchor position, e.g.
43 TCL_ANCHOR_CENTER.
44_________________________________________________________________
45
46
48 Tk_GetAnchorFromObj places in *anchorPtr an anchor position (enumerated │
49 type Tk_Anchor) corresponding to objPtr's value. The result will be │
50 one of TK_ANCHOR_N, TK_ANCHOR_NE, TK_ANCHOR_E, TK_ANCHOR_SE, │
51 TK_ANCHOR_S, TK_ANCHOR_SW, TK_ANCHOR_W, TK_ANCHOR_NW, or TK_ANCHOR_CEN‐ │
52 TER. Anchor positions are typically used for indicating a point on an │
53 object that will be used to position the object, e.g. TK_ANCHOR_N means │
54 position the top center point of the object at a particular place. │
55
56 Under normal circumstances the return value is TCL_OK and interp is │
57 unused. If string doesn't contain a valid anchor position or an abbre‐ │
58 viation of one of these names, TCL_ERROR is returned, *anchorPtr is │
59 unmodified, and an error message is stored in interp's result if interp │
60 isn't NULL. Tk_GetAnchorFromObj caches information about the return │
61 value in objPtr, which speeds up future calls to Tk_GetAnchorFromObj │
62 with the same objPtr. │
63
64 Tk_GetAnchor is identical to Tk_GetAnchorFromObj except that the │
65 description of the anchor is specified with a string instead of an │
66 object. This prevents Tk_GetAnchor from caching the return value, so │
67 Tk_GetAnchor is less efficient than Tk_GetAnchorFromObj.
68
69 Tk_NameOfAnchor is the logical inverse of Tk_GetAnchor. Given an
70 anchor position such as TK_ANCHOR_N it returns a statically-allocated
71 string corresponding to anchor. If anchor isn't a legal anchor value,
72 then ``unknown anchor position'' is returned.
73
74
76 anchor position
77
78
79
80Tk 8.1 Tk_GetAnchorFromObj(3)