From: nagai@... Date: 2002-07-12T12:51:17+09:00 Subject: Re: Ruby/Tk, TkMessage Hi, From: katiedhe@hotmail.com (Dandan He) Subject: Ruby/Tk, TkMessage Date: Tue, 9 Jul 2002 14:45:48 +0900 Message-ID: <5d85b7fe.0207082127.3f806f76@posting.google.com> > I need to use a Ruby/Tk widget to display some read-only information, > which can be multi-line. I need the widget to be displayed as a > certain size (say, width=100, height=50) even when it doesn't have any > text in it. I would use TkText if there is a way to make it read-only. Use a frame widget with fixed size. If you want to use Pack geometry manager only, you must do TkPack.propagate(, false) to block the propagation of size. For example, ------------------------------------- require 'tk' f = TkFrame.new(nil, 'width'=>100, 'height'=>50).pack TkPack.propagate(f,false) TkMessage.new(f, 'text'=>'1111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000').pack Tk.mainloop ------------------------------------- As you see when you run it, the center part of the message widget is shown. But if you want to show upper-left corner of the message widget, probably you must use Place geometry manager. For example, ------------------------------------- require 'tk' f = TkFrame.new(nil, 'width'=>100, 'height'=>50).pack TkMessage.new(f, 'text'=>'1111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000').place('x'=>0, 'y'=>0) Tk.mainloop ------------------------------------- In this case, no need TkPack.propagate. The message widget has no influence on the frame widget, because the message widget is not known by Pack geometry manager. -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)