Virtual List Control - editing column heading labels - STILL :-(

Geoff Skerrett wrote:
>>> In my event handler, event.m_col correctly returns the
>> column id, but
>>> I can't find how to get/set to the column label.
>>>
>>> In my event handler I tried;
>>> col = event.m_col
>>> item = listctl.GetColumn(col)
>>> text = listctl.GetItemText(item.id)
>>>
>>> ... But I get the text value of row[0], col[0]
>>>
>>> So what am I missing ???
>>
>> text = item.GetText()

> Got it. It returns a wx.ListItem.
> If I could trouble you with one more thing - I am now
stumped on how
> to actually change the text of the column label.
>
> I have tried the following;
>
> item.SetText('New Heading Text')
> item.SetTextColour(wx.Color(0,0,255))
> listctl.RefreshItem(item.Id)
>
> The code doesn't fail, but the column label and colour
doesn't change
> either.
> It seems to me that the item.Id doesn't return the correct
value for
> the column heading ???
>
> Any guidance would be appreciated and thanks for your patience.

You need to do a listctrl.SetColumn(col, item) after you have
made the changes to the item.

Still having problems with this ... Must be getting daft.

I modified the code so I have this;

  item.SetText('New Column')
  listctl.SetColumn(col, item)

The behaviour I am getting is that the column header label turns blank.
If I resize the column, then new column label becomes visible.

I tried calling listctl.RefreshItem(item.GetId()) but do know effect.
If I simple call listctl.RefreshItem() <- no parameter - the system
crashes, but the new column heading is displayed.

Eventually I would like to place a small image on the column header as
well. The intent is to indicate the "sort" direction.

Any assistance would be appreciated.
This seems to be a but of a mystery for me, but I am sure I am missing
something simple.

Geoff.

CANCEL this.
Problem was in my code.
It is now working exactly the way I want.

ยทยทยท

-----Original Message-----
From: Geoff Skerrett [mailto:Geoff@teammsa.com]
Sent: Monday, May 14, 2007 1:12 PM
To: wxPython-users@lists.wxwidgets.org
Subject: RE: [wxPython-users] Virtual List Control - editing
column heading labels - STILL :frowning:

> Geoff Skerrett wrote:
> >>> In my event handler, event.m_col correctly returns the
> >> column id, but
> >>> I can't find how to get/set to the column label.
> >>>
> >>> In my event handler I tried;
> >>> col = event.m_col
> >>> item = listctl.GetColumn(col)
> >>> text = listctl.GetItemText(item.id)
> >>>
> >>> ... But I get the text value of row[0], col[0]
> >>>
> >>> So what am I missing ???
> >>
> >> text = item.GetText()
>
> > Got it. It returns a wx.ListItem.
> > If I could trouble you with one more thing - I am now
> stumped on how
> > to actually change the text of the column label.
> >
> > I have tried the following;
> >
> > item.SetText('New Heading Text')
> > item.SetTextColour(wx.Color(0,0,255))
> > listctl.RefreshItem(item.Id)
> >
> > The code doesn't fail, but the column label and colour
> doesn't change
> > either.
> > It seems to me that the item.Id doesn't return the correct
> value for
> > the column heading ???
> >
> > Any guidance would be appreciated and thanks for your patience.
>
> You need to do a listctrl.SetColumn(col, item) after you
have made the
> changes to the item.
>

Still having problems with this ... Must be getting daft.

I modified the code so I have this;

  item.SetText('New Column')
  listctl.SetColumn(col, item)

The behaviour I am getting is that the column header label
turns blank.
If I resize the column, then new column label becomes visible.

I tried calling listctl.RefreshItem(item.GetId()) but do know effect.
If I simple call listctl.RefreshItem() <- no parameter - the
system crashes, but the new column heading is displayed.

Eventually I would like to place a small image on the column
header as well. The intent is to indicate the "sort" direction.

Any assistance would be appreciated.
This seems to be a but of a mystery for me, but I am sure I
am missing something simple.

Geoff.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org