Re: [Fxruby-users] Multi-colored FXList
Status: Inactive
Brought to you by:
lyle
From: Lyle J. <ly...@kn...> - 2004-03-15 14:08:45
|
On Mar 14, 2004, at 1:55 AM, Matthew Miller wrote: > FXList doesn't support [in-place editing]. Now I'm wondering how to > write a widget to > do what I want. I've looked at the C++ source for FXList and hope that > there is > an easy way to accomplish the behavior I see in sfm. After doing some > reading I > thought that I might could use a FXVerticalFrame to stack the widgets > that show > the filenames. The trouble is that I couldn't find a way to iterate > through the > contents of the frame and if necessary replace a FXLabel with a > FXTextField > object. Well, there is the FXWindow#children method in the > FXVerticalFrame > subclass, but would replacing an element in the returned array with a > different > widget affect the display? No, as you guessed, simply replacing an item in the array returned by FXWindow#children doesn't affect the window's contents. You should however be able to use either FXWindow#linkBefore or #linkAfter to reposition widgets in the vertical frame, e.g. # Replace the 5th child widget of "frame" with a text field fifthChild = parentFrame.childAtIndex(4) textField = FXTextField.new(parentFrame, ...) textField.create textField.linkAfter(fifthChild) parentFrame.removeChild(fifthChild) Note that that last call (removeChild) will actually destroy the 5th child widget completely. It's easy enough to recreate widgets on the fly, but if for some reason you want to hang on to that specific widget instance, you could instead hide it or something, i.e. fifthChild.hide # but I'm still in the list! Hope this helps, Lyle |