From: Riccardo G. <ric...@fi...> - 2004-04-02 09:13:48
|
Hi well, with Marco Frailis we have done in Ruby a ColredListItem that works following the fifthplanet answer of Lyle .. the main difference (and problem) with respect to the C++ solution was that it is not sufficient to have a ColoredListItem inheriting from an FXListItem and implementing a different draw method .. it seems that the Ruby wrapper of FXList use always the method draw of the superclass (in this case FXListItem) when it paints the widget .. our solution was to define a new ColoredList inheiritng from a FXList and reimplement just the onPaint method of this class (just coping and Ruby adapting from the C++ method onPaint of the Fox) .. in that case it calls the draw method of the ColoredListItem .. this solve our problem, but probably is not an elegant solution .. moreover we need also a ColoredTreeList and it is much more complicate to reimplement the onPaint method of the FXTreeList .. Lyle, do you know of a better (and easier) way to obtain that? Hmm .. reading back the email probably is not so clear .. if someone is interested let me know and I'll send the code .. Bye, Riccardo :) Matthew Miller wrote: > Hello, > > On the fifthplanet wiki I saw one answer to a question I hadn't asked yet ;^) > The question dealt with subclassing FXList to draw the list items in different > colors. Lyle provide a very good solution in C++. I'm wondering if, using his > solution as a guide, the same result could be done using FXRuby. I thought I > would ask and see if there were any gotchas before I tried an implementation in > Ruby. > > I've one more question as well. The way that I'm learning FXRuby is to write a > file manager that is similar to the one called sfm that was written using > GTK+. When renaming a file in sfm the equivalent of a FXLabel is replaced by a > one-line text field where the filename can be edited (i.e. the same way that the > Windows Explorer works.) > > FXList doesn't support this behavior. 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 here 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? > > Well, for both these things I'm looking for some insight. Thanks. > > Matthew. > -- +--------------------------------------------------------------+ | Riccardo Giannitrapani | | | | Dipartimento di Fisica - Room L1-14-BE | | Universita` di Udine - Via delle Scienze, 206 Udine (Italy) | | Tel (Office): +39-0432-558209 | | Home Page: http://www.fisica.uniud.it/~riccardo | | ICQ# 86590904 | +--------------------------------------------------------------+ |