[fxruby-users] Text color for individual items in FXTable

Thomas, Jason M (Software) jmthomas at ball.com
Mon Feb 25 18:06:33 EST 2008


You can use the FXTable's setCellColor to acheive a nice alternating
look as shown in the screenshot on the FXRuby website. However, it
sounds like you're trying to set individual cells which I haven't tried.

    # Table
    @table = FXTable.new(frame,
      :opts =>
TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y,
      :padding => 2)
      
    @table.visibleRows = 20
    @table.visibleColumns = 8

    @table.setTableSize(50, 14)

    @table.setBackColor(FXRGB(255, 255, 255))
    @table.setCellColor(0, 0, FXRGB(255, 255, 255))
    @table.setCellColor(0, 1, FXRGB(255, 240, 240))
    @table.setCellColor(1, 0, FXRGB(240, 255, 240))
    @table.setCellColor(1, 1, FXRGB(240, 240, 255))
 
________________________________

From: fxruby-users-bounces at rubyforge.org
[mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of Tim Smith
Sent: Monday, February 25, 2008 3:58 PM
To: fxruby-users at rubyforge.org
Subject: [fxruby-users] Text color for individual items in FXTable



Hello,

 

I would like to set text colors for individual items in an FXTable.
FXTable has a textColor accessor, but it applies to every item, not to
individual items.  So I subclassed FXTable and overrode createItem to
return a subclass of FXTableItem in which I override drawContent.  One
of drawContent's parameters is the device context dc, but when I call
dc.drawText in my customized drawContent, nothing is drawn on the
screen.  I know the method is being called.  What might be wrong?  Has
anyone else managed to set text colors for individual table items?

 

Thanks for any help,

 

Tim

 




This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.


More information about the fxruby-users mailing list