johnf wrote:
> On Tuesday 30 June 2009 01:19:26 pm Paul McNett wrote:
>> johnf wrote:
>>> It should be noted that if you set the column[idx].Visible = False you
>>> no longer have access to the value.  So for me using the column for calc
>>> is not going to work.
>> Update to r5283 and then experiment with querying
>> grid.Columns[idx].Value, which you can do whether or not the column is
>> visible.
>>
> I'm using grid.GetCellValue(row,col) to access the column I'm hiding.  That 
> returns '' as the value (should have been True or False).  Is there a better 
> way?

That's the wx.Grid method, and wx.Grid knows nothing about dabo dColumn 
objects. It can work if the column is visible though, as you know.


> Let me tell you what I'm doing.  I have a column that is changing colors (the 
> background color of the cell) depending on several data fields in the grid.

All from the same record?


> At first I was just using the bool value of the cell to support the cell 
> colors.  Then I needed an other value from the row.  And now I need a third.  
> Everything is in the row so I was just using the "GetCellValue" to set the 
> value.  

Asking for trouble like this by using the raw wx-level methods...


> But now it looks like I need to create a virtual field to handle the issue.  
> I'm sort of resisting because I already have performance troubles.  And of 
> course adding more work for the bizobj to do sounds like not the way to go.

Virtual fields will add almost no performance overhead if they don't 
need to query child bizobjs. It is definitely the cleanest way to go.

You would use col.DynamicCellBackColor, connected to a virtual field for 
this (warning: untested code below):

{{{
def getBackColor(self):
   bizVal = biz.Record.my_virtual_field
   if "a" in bizVal:
     return (0,128,10)
   if "b" in bizVal:
     return dabo.dColors["blue"]
   return "black"
col.DynamicCellBackColor = self.getBackColor
}}}

Warning: horrible performance on Windows if the virtual fields need to 
query child bizobjs (but good performance on Mac and Lin). I think the 
Windows wx.Grid calls GetValue() way too often or something.

Paul

_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/4a4a93b9.3080...@ulmcnett.com

Reply via email to