From: Lyle Johnson Date: 2002-12-12T03:40:30+09:00 Subject: Re: FXRuby : Setting Default Height/Width in an FXList Jason Persampieri wrote: > I tried to redefine the getHeight method for my > container, but that didn't seem to have any effect. > That is, I could call obj.getHeight and it would get > the value from my function, but the parent still sees > the height differently. Does that make sense? Yes. The getWidth() and getHeight() functions in the C++ library aren't virtual functions and so there's no point in overriding them in your Ruby classes. In other words, even if you were writing your GUI in C++ and not in Ruby there wouldn't be any point in overriding either of those functions. If you want a window to have a fixed height, pass in the LAYOUT_FIX_HEIGHT layout hint when you create it and then set its height to whatever (fixed) value you like: fixedHeightLabel = FXLabel.new(parent, "Label", nil, LABEL_NORMAL | LAYOUT_FIX_HEIGHT) fixedHeightLabel.height = 50 > Each widget is an FXParameterRow, which is a class I > made to show a key and value... the current > implementation is a GroupBox titled with the key > containing an FXText box with the edittable value... > whew. This sounds fine, but just out of curiosity, you do know that there is both an FXTextField widget (for single-line text inputs) and FXText (for multi-line text), right? For what you're describing, FXTextField is *probably* the appropriate choice -- it's like Tk's Entry widget (but not like Tk's Text widget). > I thought of another option though... If I could do > this as an FXList, that should handle all of the size > issues appropriately... however, it doesn't seem like > a widget can be an FXListItem (even with > subclassing)... is this correct? Correct. An FXListItem is, more or less, a basic data object and not a widget as such. It is not (ultimately) derived from FXWindow like regular widgets are. > Anyway, I still think that there should be a way to > tell a container to re-evaluate it's height... and it > should do so automatically after a child gets > destroyed. Wouldn't that make sense? Generally speaking, containers *do* re-evaluate their width and height when a child widget is added or removed (... or hidden or shown, etc.) If this doesn't seem to be happening you can force a widget to recalculate its layout by calling recalc(), e.g. FXLabel.new(aContainer, "myLabel") FXTextField(aContainer, 6) aContainer.recalc but as I said this usually isn't necessary.