1compound(n)                  Tix Built-In Commands                 compound(n)
2
3
4

NAME

6       compound - multi-line compound image type.
7

SYNOPSIS

9       image create compound ?name? ?options?
10

DESCRIPTION

12       Compound image types can be used to create images that consists of mul‐
13       tiple horizontal lines; each line is composed  of  a  series  of  items
14       (texts,  bitmaps,  images  or spaces) arranged from left to right. Com‐
15       pound images are mainly used to embed  complex  drawings  into  widgets
16       that  support the -image option. As shown in the EXAMPLE section below,
17       a compound image can be used to display a  bitmap  and  a  text  string
18       simutaneously in a TK button(n) widget.
19

CREATING COMPOUND IMAGES

21       Like  all  images,  compound  images are created using the image create
22       command. Compound images support the following options:
23
24       -background color
25              Specifies the background color of the compound image. This color
26              is  also  used  as  the  default background color for the bitmap
27              items in the compound image.
28
29       -borderwidth pixels
30              Specifies a non-negative value indicating the width of  the  3-D
31              border drawn around the compound image.
32
33       -font font
34              Specifies  the  default  font for the text items in the compound
35              image.
36
37       -foreground color
38              Specifies the default foreground color for the bitmap  and  text
39              items in the compound image.
40
41       -padx value
42              Specifies  a  non-negative value indicating how much extra space
43              to request for the compound image in the X-direction. The  value
44              may have any of the forms acceptable to Tk_GetPixels(3).
45
46       -pady value
47              Specifies  a  non-negative value indicating how much extra space
48              to request for the compound image in the Y-direction.
49
50       -relief value
51              Specifies the 3-D effect desired for the background of the  com‐
52              pound  image. Acceptable values are raised, sunken, flat, ridge,
53              and groove.
54
55       -showbackground value
56              Specifies whether the background and the 3D  borders  should  be
57              drawn.  Must be a valid boolean value. By default the background
58              is not drawn and the compound image appears to have a  transpar‐
59              ent background.
60
61       -window pathName
62              Specifies  the  window in which the compound image is displayed.
63              One compound image can be displayed in  only  one  window.  When
64              that  window  is  destroyed, the compound image is automatically
65              destroyed as well.  This option must be specified  when  calling
66              the  image  create compound command and cannot be changed by the
67              configure image command.
68

IMAGE COMMAND

70       When a compound image is created, Tk also creates a new  command  whose
71       name is the same as the image. This command may be used to invoke vari‐
72       ous operations on the image. It has the following general form:
73              imageName option ?arg arg ...?
74       Option and the args determine the exact behavior of  the  command.  The
75       following commands are possible for compound images:
76
77       imageName add line ?option value ...?
78              Creates  a  new  line at the bottom of the compound image. Lines
79              support the following options:
80
81              -anchor value
82                     Specifies how the line should be aligned along the  hori‐
83                     zontal  axis.   When the values are w, sw or nw, the line
84                     is aligned to the left. When the values are c,  s  or  n,
85                     the  line  is aligned to the middle.  When the values are
86                     e, se or ne, the line is aligned to the right.
87
88              -padx value
89                     Specifies a non-negative value indicating how much  extra
90                     space to request for this line in the X-direction.
91
92       imageName add item-type ?option value ...?
93              Creates  a new item of the type item-type at the end of the last
94              line of the compound image. All types  of  items  support  these
95              following common options:
96
97              -anchor value
98                     Specifies how the item should be aligned along the verti‐
99                     cal axis. When the values are n, nw or ne,  the  item  is
100                     aligned  to the top of the line. When the values are c, w
101                     or e, the item is aligned to  the  middle  of  the  line.
102                     When  the  values are s, se or sw, the item is aligned to
103                     the bottom of the line.
104
105              -padx value
106                     Specifies a non-negative value indicating how much  extra
107                     space to request for this item in the X-direction.
108
109              -pady value
110                     Specifies  a non-negative value indicating how much extra
111                     space to request for this item in the Y-direction.
112
113              item-type can be any of the following:
114
115       imageName add bitmap ?option value ...?
116              Creates a new bitmap item of at the end of the last line of  the
117              compound  image.  Additional options accepted by the bitmap type
118              are:
119
120              -background color
121                     Specifies the background color of the bitmap item.
122
123              -bitmap name
124                     Specifies a bitmap to display in this item, in any of the
125                     forms acceptable to Tk_GetBitmap(3).
126
127              -foreground color
128                     Specifies the foreground color of the bitmap item.
129
130       imageName add image ?option value ...?
131              Creates  a  new image item of at the end of the last line of the
132              compound image. Additional options accepted by  the  image  type
133              are:
134
135              -image name
136                     Specifies  an  image  to  display in this item. name must
137                     have been created with the image create command.
138
139       imageName add space ?option value ...?
140              Creates a new space item of at the end of the last line  of  the
141              compound  image.  Space items do not display anything. They just
142              acts as space holders that add additional spaces  between  items
143              inside  a  compound  image.  Additional  options accepted by the
144              image type are:
145
146              -width value
147                     Specifies the width of this space. The value may have any
148                     of the forms acceptable to Tk_GetPixels(3).
149
150              -height value
151                     Specifies  the  height  of this space. The value may have
152                     any of the forms acceptable to Tk_GetPixels(3).
153
154       imageName add text ?option value ...?
155              Creates a new text item of at the end of the last  line  of  the
156              compound  image.  Additional  options  accepted by the text type
157              are:
158
159              -background color
160                     Specifies the background color of the text item.
161
162              -font name
163                     Specifies the font to be used for this text item.
164
165              -foreground color
166                     Specifies the foreground color of the text item.
167
168              -justify value
169                     When there are multiple lines of text displayed in a text
170                     item,  this  option determines how the lines line up with
171                     each other. value must be one of left, center, or  right.
172                     Left means that the lines' left edges all line up, center
173                     means that the lines'  centers  are  aligned,  and  right
174                     means that the lines' right edges line up.
175
176              -text string
177                     Specifies a text string to display in this text item.
178
179              -underline value
180                     Specifies  the  integer index of a character to underline
181                     in the text item. 0 corresponds to the first character of
182                     the  text displayed in the text item, 1 to the next char‐
183                     acter, and so on.
184
185              -wraplength value
186                     This option specifies the  maximum  line  length  of  the
187                     label string on this text item. If the line length of the
188                     label string exceeds this length, it is wrapped onto  the
189                     next  line,  so that no line is longer than the specified
190                     length. The value may be specified in any of the standard
191                     forms for screen distances. If this value is less than or
192                     equal to 0 then no wrapping is  done:  lines  will  break
193                     only at newline characters in the text.
194
195       imageName cget option
196              Returns  the  current value of the configuration option given by
197              option. Option may have any of the values accepted by the  image
198              create compound command.
199
200       imageName configure ?option? ?value option value ...?
201              Query  or  modify the configuration options for the image. If no
202              option is specified, returns a list describing all of the avail‐
203              able options for imageName (see Tk_ConfigureInfo for information
204              on the format of this list).  If option  is  specified  with  no
205              value,  then the command returns a list describing the one named
206              option (this list will be identical to the corresponding sublist
207              of  the  value  returned  if no option is specified).  If one or
208              more option-value pairs are specified, then the command modifies
209              the given option(s) to have the given value(s); in this case the
210              command returns an empty string. Option may have any of the val‐
211              ues  accepted  by  the image create compound command, except the
212              -window option
213

EXAMPLE

215       The following example creates a compound image with a bitmap and a text
216       string  and  places  this image into a Tk bitton(n) widget. Notice that
217       the image must be created after the creation  of  the  window  that  it
218       resides in.
219
220       set  btn  [button .b] set img [image create compound -window $btn] $img
221       add line $img add bitmap -bitmap warning $img add space -width  8  $img
222       add text -text "Warning" -underline 0 $btn config -image $img pack $btn
223

KEYWORDS

225       image(n), Tix(n)
226
227
228
229
230
231Tix                                   4.0                          compound(n)
Impressum