> Today's Topics:
>
> 1. makePositionVisible() fails in FXList, FXTreeList (David L Hawley)
>
> Message: 1
> Date: Sun, 07 Mar 2004 20:21:46 -0800
> To: fxr...@li...
> From: David L Hawley <Dav...@co...>
> Subject: [Fxruby-users] makePositionVisible() fails in FXList, FXTreeList
> Reply-To: fxr...@li...
>
> Hi,
>
> I'm new to Ruby, Fox and this list. Am enjoying both Ruby and FXRuby,
> although I'm having trouble figuring out how to do things. My application
> is sort of like an RS-232 terminal (similar to Procomm). I'm using the
> SerialPort module, which more or less works. It fails with addInput() -
> the callback is called immediatly which causes a few problems to say the
> least. Using addTimeout is a work around for now.
>
> My big problem now is that I can't seem to get makePositionVisible() to
> work in both in FXList and FXTreeList. I've tried the index and item
> version in FXList, item in FXTreeList. In both cases, the list scrolls to
> the first element in the list. I can use FXText to display my data, and
> there makePositionVisible() works. However, I'd rather have lines as
> items...
>
> I'm trying to log events in the lists, and would like the list to scroll
> up to display the most recent.
>
> my append code looks like this:
> if USE_TREE
> item= @cmdOutput.addItemLast(nil, text)
> @cmdOutput.makeItemVisible(item) # list scrolls to first
> item
> elsif USE_TXT_LIST
> ix= @cmdOutput.appendItem(item= FXListItem.new(text))
> @cmdOutput.makeItemVisible(item) # list scrolls to first
> item
> OR
> @cmdOutput.makeItemVisible(ix) # list scrolls to first
> item
> else
> @cmdOutput.appendText(text)
> @cmdOutput.makePositionVisible(@cmdOutput.text.length) # srolls to
> put last line at bottom where I want
> end
>
> Any ideas?
>
> Message: 3
> From: jeroen <je...@fo...>
> Organization: FOX Toolkit
> To: David L Hawley <Dav...@co...>
> Subject: Re: [Fxruby-users] makePositionVisible() fails in FXList,
> FXTreeList
> Date: Mon, 8 Mar 2004 07:59:06 -0600
> Cc: fxr...@li...
> Reply-To: fxr...@li...
>
> The thing to remember is that makeItemVisible() can't work until the
> item sizes have been determined. The widget's contents are measured
> AFTER create() has been called, and AFTER a layout() has been performed.
>
> So, if you've just added an item, make sure the item is created, and
> then call layout() on the widget to force a size-computation. Now
> makeItemVisible() knows all the information to do its thing.
>
> Hope this helps,
>
>
> Jeroen
>
Jeroen,
Thankyou, this is makes sense, however the FXRuby implimentation appears
to hide
create() and layout() - at least I don't see those methods listed
for any FXRuby objects I've looked at.
On the otherhand, I can put a "scroll to end" button with a connect command
@cmdOutput.makeItemVisible(@cmdOutput.lastItem) and scroll does work.
So the question is where to place the makeItemVisible call.
OK, here's a kludge - I can add into my onTimeout method and have it fire
when there's no input from the serial port. This works, although I don't
like it.
It would appear that the FXRuby call is broken in some respect.
Dave
|