1Tk_GetJustifyFromObj(3) Tk Library Procedures Tk_GetJustifyFromObj(3)
2
3
4
5______________________________________________________________________________
6
8 Tk_GetJustifyFromObj, Tk_GetJustify, Tk_NameOfJustify - translate be‐
9 tween strings and justification styles
10
12 #include <tk.h>
13
14 int
15 Tk_GetJustifyFromObj(interp, objPtr, justifyPtr)
16
17 int
18 Tk_GetJustify(interp, string, justifyPtr)
19
20 const char *
21 Tk_NameOfJustify(justify)
22
24 Tcl_Interp *interp (in) Interpreter to use for error re‐
25 porting, or NULL.
26
27 Tcl_Obj *objPtr (in/out) String value contains name of jus‐
28 tification style - one of “left”,
29 “right”, or “center” - or a unique
30 abbreviation of one. The internal
31 rep will be modified to cache cor‐
32 responding justify value.
33
34 const char *string (in) Same as objPtr except description
35 of justification style is passed
36 as a string.
37
38 int *justifyPtr (out) Pointer to location in which to
39 store justify value corresponding
40 to objPtr or string.
41
42 Tk_Justify justify (in) Justification style (one of the
43 values listed below).
44______________________________________________________________________________
45
47 Tk_GetJustifyFromObj places in *justifyPtr the justify value corre‐
48 sponding to objPtr's value. This value will be one of the following:
49
50 TK_JUSTIFY_LEFT
51 Means that the text on each line should start at the left edge
52 of the line; as a result, the right edges of lines may be
53 ragged.
54
55 TK_JUSTIFY_RIGHT
56 Means that the text on each line should end at the right edge of
57 the line; as a result, the left edges of lines may be ragged.
58
59 TK_JUSTIFY_CENTER
60 Means that the text on each line should be centered; as a re‐
61 sult, both the left and right edges of lines may be ragged.
62
63 Under normal circumstances the return value is TCL_OK and interp is un‐
64 used. If objPtr does not contain a valid justification style or an ab‐
65 breviation of one of these names, TCL_ERROR is returned, *justifyPtr is
66 unmodified, and an error message is stored in interp's result if interp
67 is not NULL. Tk_GetJustifyFromObj caches information about the return
68 value in objPtr, which speeds up future calls to Tk_GetJustifyFromObj
69 with the same objPtr.
70
71 Tk_GetJustify is identical to Tk_GetJustifyFromObj except that the de‐
72 scription of the justification is specified with a string instead of an
73 object. This prevents Tk_GetJustify from caching the return value, so
74 Tk_GetJustify is less efficient than Tk_GetJustifyFromObj.
75
76 Tk_NameOfJustify is the logical inverse of Tk_GetJustify. Given a jus‐
77 tify value it returns a statically-allocated string corresponding to
78 justify. If justify is not a legal justify value, then “unknown justi‐
79 fication style” is returned.
80
82 center, fill, justification, string
83
84
85
86Tk 8.1 Tk_GetJustifyFromObj(3)