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.
44                                          TCL_ANCHOR_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,
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  does  not  contain  a valid anchor position or an
58       abbreviation of one of these names, TCL_ERROR is  returned,  *anchorPtr
59       is  unmodified,  and  an  error message is stored in interp's result if
60       interp is not NULL.  Tk_GetAnchorFromObj caches information  about  the
61       return  value  in objPtr, which speeds up future calls to Tk_GetAnchor‐
62       FromObj 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 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