[Fxruby-users] (no subject)
Status: Inactive
Brought to you by:
lyle
|
From: TOGoS <chu...@ya...> - 2004-06-07 00:20:53
|
Hi all.
I'm trying to use Fox to make a chat program. I want
to have a list that displayes messages as they come
in. Unfortunately, I'm having trouble getting the
FXList to scroll down. Using makeItemVisible doesn't
seem to do the trick, and neither does anything else
I've tried (setCurrentItem, updateItem, etc). The
following script shows the problem by periodically
inserting data into a FXText and a FXList, and
attempting to scroll to the bottom of each. Works for
the text, but not the list. Can anyone help me out?
#~/usr/bin/ruby
require 'fox'
app = Fox::FXApp.new()
mainwin = Fox::FXMainWindow.new( app,
"FoxTest", NIL,NIL,
Fox::DECOR_ALL,128,128,128,64 )
frame = Fox::FXHorizontalFrame.new( mainwin,
Fox::LAYOUT_FILL_X|
Fox::LAYOUT_FILL_Y )
list = Fox::FXList.new( frame, 0, NIL, 0,
Fox::LIST_NORMAL|
Fox::LAYOUT_FILL_X|
Fox::LAYOUT_FILL_Y,
0,0,64,64 )
textbox = Fox::FXText.new( frame, NIL, 0,
Fox::TEXT_READONLY|
Fox::LAYOUT_FILL_X|
Fox::LAYOUT_FILL_Y )
app.create()
mainwin.show()
Thread.abort_on_exception = TRUE
Thread.new do
listendpos = 0
textendpos = 0
while TRUE
listendpos = list.appendItem(
"foonly #{listendpos}" )
list.makeItemVisible( listendpos )
textbox.appendText( "foonly #{textendpos}\n" )
textendpos = textbox.lineEnd(
textbox.getBottomLine() )
textbox.makePositionVisible( textendpos )
sleep(1)
end
end
app.run()
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
|