1Tk_GetAnchorFromObj(3)       Tk Library Procedures      Tk_GetAnchorFromObj(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tk_GetAnchorFromObj,  Tk_GetAnchor, Tk_NameOfAnchor - translate between
9       strings and anchor positions
10

SYNOPSIS

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

ARGUMENTS

24       Tcl_Interp *interp (in)            Interpreter to use for error report‐
25                                          ing, or NULL.
26
27       Tcl_Obj *objPtr (in/out)           String value contains name of anchor
28                                          point: “n”, “ne”,  “e”,  “se”,  “s”,
29sw”, “w”, “nw”, or “center”; inter‐
30                                          nal rep will be  modified  to  cache
31                                          corresponding Tk_Anchor. In the case
32                                          of “center” on  input,  a  non-empty
33                                          abbreviation  of it may also be used
34                                          on input.
35
36       const char *string (in)            Same as objPtr except description of
37                                          anchor point is passed as a string.
38
39       int *anchorPtr (out)               Pointer  to  location  in  which  to
40                                          store anchor position  corresponding
41                                          to objPtr or string.
42
43       Tk_Anchor anchor (in)              Anchor    position,   e.g.   TCL_AN‐
44                                          CHOR_CENTER.
45______________________________________________________________________________
46

DESCRIPTION

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,  TK_AN‐
51       CHOR_S,  TK_ANCHOR_SW,  TK_ANCHOR_W, TK_ANCHOR_NW, or TK_ANCHOR_CENTER.
52       Anchor positions are typically used for indicating a point on an object
53       that  will be used to position the object, e.g. TK_ANCHOR_N means posi‐
54       tion 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 un‐
57       used.   If string does not contain a valid anchor position or an abbre‐
58       viation of one of these names, TCL_ERROR is returned, *anchorPtr is un‐
59       modified,  and  an error message is stored in interp's result if interp
60       is not 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  de‐
65       scription  of  the  anchor is specified with a string instead of an ob‐
66       ject.  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 an‐
70       chor position such as TK_ANCHOR_N  it  returns  a  statically-allocated
71       string corresponding to anchor.  If anchor is not a legal anchor value,
72       then “unknown anchor position” is returned.
73

KEYWORDS

75       anchor position
76
77
78
79Tk                                    8.1               Tk_GetAnchorFromObj(3)
Impressum