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”,
29                                          “sw”, “w”, “nw”, or “center”; inter‐
30                                          nal rep will be  modified  to  cache
31                                          corresponding Tk_Anchor.
32
33       const char *string (in)            Same as objPtr except description of
34                                          anchor point is passed as a string.
35
36       int *anchorPtr (out)               Pointer  to  location  in  which  to
37                                          store  anchor position corresponding
38                                          to objPtr or string.
39
40       Tk_Anchor anchor (in)              Anchor        position,         e.g.
41                                          TCL_ANCHOR_CENTER.
42_________________________________________________________________
43

DESCRIPTION

45       Tk_GetAnchorFromObj places in *anchorPtr an anchor position (enumerated
46       type Tk_Anchor) corresponding to objPtr's value.  The  result  will  be
47       one    of   TK_ANCHOR_N,   TK_ANCHOR_NE,   TK_ANCHOR_E,   TK_ANCHOR_SE,
48       TK_ANCHOR_S, TK_ANCHOR_SW, TK_ANCHOR_W, TK_ANCHOR_NW, or TK_ANCHOR_CEN‐
49       TER.   Anchor positions are typically used for indicating a point on an
50       object that will be used to position the object, e.g. TK_ANCHOR_N means
51       position the top center point of the object at a particular place.
52
53       Under  normal  circumstances  the  return value is TCL_OK and interp is
54       unused.  If string does not contain  a  valid  anchor  position  or  an
55       abbreviation  of  one of these names, TCL_ERROR is returned, *anchorPtr
56       is unmodified, and an error message is stored  in  interp's  result  if
57       interp  is  not NULL.  Tk_GetAnchorFromObj caches information about the
58       return value in objPtr, which speeds up future calls  to  Tk_GetAnchor‐
59       FromObj with the same objPtr.
60
61       Tk_GetAnchor  is  identical  to  Tk_GetAnchorFromObj  except  that  the
62       description of the anchor is specified with  a  string  instead  of  an
63       object.   This  prevents Tk_GetAnchor from caching the return value, so
64       Tk_GetAnchor is less efficient than Tk_GetAnchorFromObj.
65
66       Tk_NameOfAnchor is the  logical  inverse  of  Tk_GetAnchor.   Given  an
67       anchor  position  such as TK_ANCHOR_N it returns a statically-allocated
68       string corresponding to anchor.  If anchor is not a legal anchor value,
69       then “unknown anchor position” is returned.
70

KEYWORDS

72       anchor position
73
74
75
76Tk                                    8.1               Tk_GetAnchorFromObj(3)
Impressum