3.7 Messages

aspect and justify

Message widgets display text extending over several lines. How the text is distributed over several lines is determined by one of the options width and aspect. Each of the line is justified according to the value of the option justify. Possible values are left (the default value), center, and right. Figure 3.7 shows the result of different combinations of aspect and justification.


S ='Text extending over several lines.' 
Ms={Map [left#200 center#100 right#50]
    fun {$ J#A}
       {New Tk.message tkInit(parent:W text:S justify:J aspect:A)}
    end}
{Tk.send pack(b(Ms) side:left padx:2#m pady:2#m)}

Figure 3.7: Messages with justify and aspect options.


aspect and width

If the option width is present, the value (a screen distance, see Section 3.3.2) gives the length of each line. If no width option is present, the aspect ratio between height and width of the text is given by the option aspect. The value specifies the aspect as

100 * width / height

For example a value of 100 means that the text is as high as wide, a value of 200 means that the text is twice as wide as high.

Reference information on message widgets can be found in message.


Christian Schulte
Version 1.4.0 (20080702)