Is there a way to hide a column. I want to use the column info in a calc but
do not want to display the column.
--
John Fabiani
johnf wrote:
> Is there a way to hide a column. I want to use the column info in a calc but
> do not want to display the column.
col.Visible = False
You are using a UI control for a business calculation, eh? ;)
(can't you just use the underlying dataset to run your calc?)
Paul
On Tuesday 30 June 2009 11:38:39 am johnf wrote:
> Is there a way to hide a column. I want to use the column info in a calc
> but do not want to display the column.
grid.column[num].Visible = False
Sorry for the noise
--
John Fabiani
johnf wrote:
> On Tuesday 30 June 2009 11:38:39 am johnf wrote:
>> Is there a way to hide a column. I want to use the column info in a calc
>> but do not want to display the column.
>
> grid.column[num].Visible = False
Actually:
grid.Columns[idx].Visible = False
Paul
On Tuesday 30 June 2009 11:45:07 am Paul McNett wrote:
> johnf wrote:
> > Is there a way to hide a column. I want to use the column info in a calc
> > but do not want to display the column.
>
> col.Visible = False
>
> You are using a UI control for a business calculation, eh? ;)
>
> (can't you just use the underlying dataset to run your calc?)
>
> Paul
Yes I have been thinking about it a lot. That is using the bizobj to due the
calc. 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.
--
John Fabiani
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.
Paul
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.
>
> Paul
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?
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.
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.
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.
--
John Fabiani
On Tuesday 30 June 2009 03:00:35 pm 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.
> >
> > Paul
>
> 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?
>
> 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. 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.
>
> 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.
not so fast I found "resched = grid.DataSet[row]['resched']" that works.
--
John Fabiani
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