|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
FXTable::fitColumnsToContentsLyle: I have tried your suggested replacement for fitColumnsToContents. While it is better than the "standard" version, it does not completely cure my problem. It does not get a large enough value for the width of the heading text, and so far I have not determined why. I found that if I increase this size estimate by 1/3 then the display looks about right. That is, the line that determines "hw" is now: hw = columnHeader.font.getTextWidth(columnHeader.getItemText(c))*4/3 However, this is a somewhat arbitrary solution to the problem, I am hoping someone knows why the call to font.getTextWidth does not return an adequate value. The font I am using for the cell headers is: @tahoma10Bold = FXFont.new(app, "Tahoma", 10, FXFont::Bold) The font for the table contents is: @courierNew10 = FXFont.new(app, "Courier New", 10) # 10 point, fixed width Thanks Dave ____________________________________________________________ David C. Toll, Research Staff Member, Secure Systems and Smart Cards IBM T. J. Watson Research Center, 19 Skyline Drive, Hawthorne NY 10532 Phone: 914-784-7019 (t/l 863) Fax: 914-784-6205 (t/l 863) email: toll@... _______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
|
|
Re: FXTable::fitColumnsToContentsOn May 19, 2008, at 1:56 PM, David Toll wrote: I have tried your suggested replacement for fitColumnsToContents. While it is better than the "standard" version, it does not completely cure my problem. It does not get a large enough value for the width of the heading text, and so far I have not determined why. I found that if I increase this size estimate by 1/3 then the display looks about right. That is, the line that determines "hw" is now: hw = columnHeader.font.getTextWidth(columnHeader.getItemText(c)) + marginLeft + marginRight You get a bit closer to the correct width. But for the particular big font that I'm trying it's still a little short. I don't know if this indicates a bug in FXFont::getTextWidth(), or if there's still some factor that I'm overlooking. Hope this helps, Lyle --- "FXRuby: Create Lean and Mean GUIs with Ruby" Now available from the Pragmatic Bookshelf! _______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
|
|
Re: FXTable::fitColumnsToContentsOn May 19, 2008, at 8:34 PM, Lyle Johnson wrote: > I see part of the problem, now that I look at it again. We're not > taking into account the cell margin values. So if you change the > calculation of "hw" to this: > > hw = columnHeader.font.getTextWidth(columnHeader.getItemText(c)) + > marginLeft + marginRight > > You get a bit closer to the correct width. But for the particular > big font that I'm trying it's still a little short. I don't know if > this indicates a bug in FXFont::getTextWidth(), or if there's still > some factor that I'm overlooking. Wait, I've got it now. The spacing's different because it's a header item and not a table item. Here's the correct formula: hw = columnHeader.font.getTextWidth(columnHeader.getItemText(c)) + 2*columnHeader.borderWidth + columnHeader.padLeft + columnHeader.padRight That looks right here, for the font that I'm testing with. Let me know what you think! -- Lyle --- "FXRuby: Create Lean and Mean GUIs with Ruby" Now available from the Pragmatic Bookshelf! http://www.pragprog.com/titles/fxruby _______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
|
|
FXTable::fitColumnsToContentsOn May 19, 2008, at 9:43 PM, Lyle Johnson wrote: Wait, I've got it now. The spacing's different because it's a header item and not a table item. Here's the correct formula: hw = columnHeader.font.getTextWidth(columnHeader.getItemText(c)) + 2*columnHeader.borderWidth + columnHeader.padLeft + columnHeader.padRight That looks right here, for the font that I'm testing with. Let me know what you think! That does indeed work as I would expect. Thank you. Does this mean there is a bug in the "standard" version of fitColumnstoContents - i.e. should the standard version be changed to this new version? Dave ____________________________________________________________ David C. Toll, Research Staff Member, Secure Embedded Systems IBM T. J. Watson Research Center, 19 Skyline Drive, Hawthorne NY 10532 Phone: 914-784-7019 (t/l 863) Fax: 914-784-6205 (t/l 863) email: toll@... _______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
|
|
Re: FXTable::fitColumnsToContentsOn Tue, May 20, 2008 at 9:05 AM, David Toll <toll@...> wrote:
> That does indeed work as I would expect. Thank you. > > Does this mean there is a bug in the "standard" version of > fitColumnstoContents - i.e. should the standard version be changed to this > new version? I would consider it a bug, but I don't know if Jeroen (FOX's developer) would. _______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
| Free Forum Powered by Nabble | Forum Help |