| Kaitzschu 2005-04-27, 4:00 pm |
| On Tue, 26 Apr 2005, Ian Bell wrote:
> Is there any way to centre multi-line text in a tk_messageBox other than
> by judicious padding with spaces?
Doesn't seem to be, tk_messageBox is a blocking procedure, so one has to
forget about
.__tk__messagebox.msg -justify center
afterwards.
But all is not lost, yet. We can use option database for this. Messagebox
is of class Dialog, so
option add *Dialog.msg.justify center
should do the trick. Alas, it doesn't, msgbox.tcl hardwires justify. So it
is up to you to grab lib/tk8.?/msgbox.tcl and do the magic. Here is diff
for 8.5a2 msgbox.tcl:
293c293,294
< label $w.msg -anchor nw -justify left -text $data(-message) \
---
> option add *Dialog.msg.justify left widgetDefault
> label $w.msg -anchor nw -text $data(-message) \
Now Dialog.msg respects justify, and you can adjust justifying.
Bad things probably happen with this, as I guess *Dialog.msg isn't just
tk_messageBox... But hey, I've never used option database so far, so this
is just a sketch for someone else to fill up :)
--
-Kaitzschu
s="TCL ";while true;do echo -en "\r$s";s=${s:1:${#s}}${s:0:1};sleep .1;done
|