## Tcl9.0.3/Tk9.0.3 Documentation > Tk C API > GetAnchor

### Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

  NAME
    Tk_GetAnchorFromObj, Tk_GetAnchor, Tk_NameOfAnchor — 文字列と錨位置の間の翻訳 translate between strings and anchor positions
  SYNOPSIS
    #include <tk.h>
    int
    Tk_GetAnchorFromObj(interp, objPtr, anchorPtr)
    int
    Tk_GetAnchor(interp, string, anchorPtr)
    const char *
    Tk_NameOfAnchor(anchor)
  引数 ARGUMENTS
    Tcl_Interp *interp (入力in)
    Tcl_Obj *objPtr (入出力in/out)
    const char *string (入力in)
    int *anchorPtr (出力out)
    Tk_Anchor anchor (入力in)
  説明 DESCRIPTION
  KEYWORDS

### NAME

Tk_GetAnchorFromObj, Tk_GetAnchor, Tk_NameOfAnchor — 文字列と錨位置の間の翻訳 translate between strings and anchor positions

### SYNOPSIS

#include <tk.h>
int
Tk_GetAnchorFromObj(interp, objPtr, anchorPtr)
int
Tk_GetAnchor(interp, string, anchorPtr)
const char *
Tk_NameOfAnchor(anchor)

### 引数 ARGUMENTS

Tcl_Interp *interp (入力in)
  不都合の又はNULLの報告に使う解釈実行機能｡ Interpreter to use for error reporting, or NULL.

Tcl_Obj *objPtr (入出力in/out)
  錨位置の名前を含む文字列値: “n” か “ne” か “e” か “se” か “s” か “sw” か “w” か “nw” か “center” ; 内部代表は Tk_Anchor に対応する高速記憶に修正される｡入力が “center” の場合､その非空の短縮形が入力に使用されるかもしれない｡ String value contains name of anchor point: “n”, “ne”, “e”, “se”, “s”, “sw”, “w”, “nw”, or “center”; internal rep will be modified to cache corresponding Tk_Anchor. In the case of “center” on input, a non-empty abbreviation of it may also be used on input.

const char *string (入力in)
  objPtr に同じ､但し､錨位置が文字列として渡された記述を除く｡　 Same as objPtr except description of anchor point is passed as a string.

int *anchorPtr (出力out)
  objPtr又は文字列に対応する錨位置を保存する位置の指示子｡ Pointer to location in which to store anchor position corresponding to objPtr or string.

Tk_Anchor anchor (入力in)
  錨位置､譬ば､TCL_ANCHOR_CENTER｡ Anchor position, e.g. TCL_ANCHOR_CENTER.

### 説明 DESCRIPTION

Tk_GetAnchorFromObj は *anchorPtr に objPtr の 値に対応する錨位置( Tk_Anchor は列挙型)を設置する｡結果の値は次の内の一つである TK_ANCHOR_N, TK_ANCHOR_NE, TK_ANCHOR_E, TK_ANCHOR_SE, TK_ANCHOR_S, TK_ANCHOR_SW, TK_ANCHOR_W, TK_ANCHOR_NW, or TK_ANCHOR_CENTER ｡錨位置は典型的には､対象の上にある点を指し示す為に使われ､それは対象を配置する為に使われる､譬えば TK_ANCHOR_N は､特定の位置に対象の中心を配置することを意味する｡ Tk_GetAnchorFromObj places in *anchorPtr an anchor position (enumerated type Tk_Anchor) corresponding to objPtr's value. The result will be one of TK_ANCHOR_N, TK_ANCHOR_NE, TK_ANCHOR_E, TK_ANCHOR_SE, TK_ANCHOR_S, TK_ANCHOR_SW, TK_ANCHOR_W, TK_ANCHOR_NW, or TK_ANCHOR_CENTER. Anchor positions are typically used for indicating a point on an object that will be used to position the object, e.g. TK_ANCHOR_N means position the top center point of the object at a particular place.

通常の状況下では返り値は TCL_OK であり解釈実行機能は使われない｡もし文字列が適切な錨位置もその名前の一つの短縮形も含まない場合 TCL_ERROR が返され *anchorPtr は修正されず､解釈実行機能が NULL でなければ､不都合伝言文が解釈実行機能に残される｡ Tk_GetAnchorFromObj は objPtr 内の返り値に関する情報を高速記憶域に記憶するので､同じ objPtr を伴う将来の Tk_GetAnchorFromObj 呼出しは加速される｡ Under normal circumstances the return value is TCL_OK and interp is unused. If string does not contain a valid anchor position or an abbreviation of one of these names, TCL_ERROR is returned, *anchorPtr is unmodified, and an error message is stored in interp's result if interp is not NULL. Tk_GetAnchorFromObj caches information about the return value in objPtr, which speeds up future calls to Tk_GetAnchorFromObj with the same objPtr.

Tk_GetAnchor は Tk_GetAnchorFromObj と同一であるが違いは､錨が対象でなく文字列で指定されることである｡これは Tk_GetAnchor を高速記憶から阻むので Tk_GetAnchor は Tk_GetAnchorFromObj より効率が見劣りする｡ Tk_GetAnchor is identical to Tk_GetAnchorFromObj except that the description of the anchor is specified with a string instead of an object. This prevents Tk_GetAnchor from caching the return value, so Tk_GetAnchor is less efficient than Tk_GetAnchorFromObj.

Tk_NameOfAnchor は論理的に Tk_GetAnchor の逆である｡ TK_ANCHOR_N の様な錨位置を与えられ､ anchor に対尾する静的に割付られた文字列を返す｡もし anchor が適切な値でない場合 “unknown anchor position[未知の錨位置]” が返される｡ Tk_NameOfAnchor is the logical inverse of Tk_GetAnchor. Given an anchor position such as TK_ANCHOR_N it returns a statically-allocated string corresponding to anchor. If anchor is not a legal anchor value, then “unknown anchor position” is returned.

### KEYWORDS

anchor position
Copyright © 1990 The Regents of the University of California.
Copyright © 1994-1998 Sun Microsystems, Inc.