From: Takaaki T. <tt...@kt...> - 2002-03-09 20:39:07
|
At Sun, 10 Mar 2002 01:37:43 +0800, Richard Bates wrote: > think I can get someone to show a simple example of using textdisplay? I'm not sure what is a correct way to show a buffer text. I think we should call show_insert_position() in handle(). In the following example, TextDisplay shows its buffer text when handling an event FOCUS. === example.rb == require 'fltk' class MyTextDisplay < FLTK::TextDisplay def handle(e) case e when FLTK::FOCUS show_insert_position() return true else return false end end end w = FLTK::Window.new(0,0,200,200){ d = MyTextDisplay.new(200,200) b = FLTK::TextBuffer.new(100) b.text = "this is a buffer text." d.buffer = b d.insert_position(0) } w.show FLTK::run() ==== -- Takaaki Tateishi <tt...@kt...> |