I'm working with a multiple-selection wxTreeCtrl and I want to
programmatically change the label for individual items from time to time. I
call wxTreeCtrl::SetItemText(treeItemId, String) passing in the treeItemId
of the one tree item currently selected. I get an AssertionError saying
this method is only available with single selection wxTreeCtrl's. So how
can I change the label text programmatically in a multi-select wxTreeCtrl?
Thanks.
I'm working with a multiple-selection wxTreeCtrl and I want to
programmatically change the label for individual items from time to time. I
call wxTreeCtrl::SetItemText(treeItemId, String) passing in the treeItemId
of the one tree item currently selected. I get an AssertionError saying
this method is only available with single selection wxTreeCtrl's. So how
can I change the label text programmatically in a multi-select wxTreeCtrl?
Platform, version and sample code?
If you are using MSW it looks like that error is actually coming from GetSelection which is called in SetItemText when there is an active edit control to see if needs to change the text in the control too. Please enter a bug report about this and perhaps it can be fixed to not assert in this situation.
One way to work around it is to ensure that the edit control is dismissed before you call SetItemText. Another would be to catch and ignore the exception in this case, the item's text has already been changed so it should be okay.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I'm using Win2K with Python 2.2.2 and wxPython 2.4.0.2u.
To provide some sample code, I went to the wxTreeCtrl.py that comes with the
wxPython demo and modified the tree to make it a multi-select. Then I added
a line in the OnSelChanged() method to just set the item text on whatever
tree item is selected. When I ran it, I was unable to duplicate the problem
exactly as I had been seeing it when running my code. I did, however, get
the AssertionError when I right-clicked on a tree item (putting me into the
edit mode), then exited the edit mode by clicking either mouse button. No
exception when I exit edit mode by pressing the <Enter> key, only when I
exit edit mode by clicking either mouse button. File attached.
In your reply, you referred to dismissing an edit control. How do I do
that...by calling wxTreeCtrl::EndEditLabel()? Thanks for your help.
-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Thursday, June 19, 2003 12:25 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] Problems setting item text in a
Multi-Select wxTreeCtrl
Paul Gardella wrote:
Hi folks.
I'm working with a multiple-selection wxTreeCtrl and I want to
programmatically change the label for individual items from time to time.
I
call wxTreeCtrl::SetItemText(treeItemId, String) passing in the treeItemId
of the one tree item currently selected. I get an AssertionError saying
this method is only available with single selection wxTreeCtrl's. So how
can I change the label text programmatically in a multi-select
wxTreeCtrl?
Platform, version and sample code?
If you are using MSW it looks like that error is actually coming from
GetSelection which is called in SetItemText when there is an active edit
control to see if needs to change the text in the control too. Please
enter a bug report about this and perhaps it can be fixed to not assert
in this situation.
One way to work around it is to ensure that the edit control is
dismissed before you call SetItemText. Another would be to catch and
ignore the exception in this case, the item's text has already been
changed so it should be okay.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
I'm using Win2K with Python 2.2.2 and wxPython 2.4.0.2u.
To provide some sample code, I went to the wxTreeCtrl.py that comes with the
wxPython demo and modified the tree to make it a multi-select. Then I added
a line in the OnSelChanged() method to just set the item text on whatever
tree item is selected. When I ran it, I was unable to duplicate the problem
exactly as I had been seeing it when running my code. I did, however, get
the AssertionError when I right-clicked on a tree item (putting me into the
edit mode), then exited the edit mode by clicking either mouse button. No
exception when I exit edit mode by pressing the <Enter> key, only when I
exit edit mode by clicking either mouse button. File attached.
Please enter a bug report about this, with a category of wxMSW.
In your reply, you referred to dismissing an edit control. How do I do
that...by calling wxTreeCtrl::EndEditLabel()?
Yes.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Regarding wxTreeCtrl::EndEditLabel(), the docs for wxPython 2.4.0.2u say
that it only works with MSW. Is that still true? If so, it could be a
problem, because some of my users are using Linux. Thanks.
Paul
···
-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Thursday, June 19, 2003 8:20 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] Problems setting item text in a
Multi-Select wxTreeCtrl
Paul Gardella wrote:
Robin,
Thanks for replying.
I'm using Win2K with Python 2.2.2 and wxPython 2.4.0.2u.
To provide some sample code, I went to the wxTreeCtrl.py that comes with
the
wxPython demo and modified the tree to make it a multi-select. Then I
added
a line in the OnSelChanged() method to just set the item text on whatever
tree item is selected. When I ran it, I was unable to duplicate the
problem
exactly as I had been seeing it when running my code. I did, however, get
the AssertionError when I right-clicked on a tree item (putting me into
the
edit mode), then exited the edit mode by clicking either mouse button. No
exception when I exit edit mode by pressing the <Enter> key, only when I
exit edit mode by clicking either mouse button. File attached.
Please enter a bug report about this, with a category of wxMSW.
In your reply, you referred to dismissing an edit control. How do I do
that...by calling wxTreeCtrl::EndEditLabel()?
Yes.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
OK, I give up...how do I enter a bug? I clicked on "Report a bug" link on
the wxPython page, and it takes me to SourceForge. I log into SourceForge,
then I'm lost. Or I don't log into SourceForge...I'm still lost. Thanks.
Paul
···
-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Thursday, June 19, 2003 8:20 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] Problems setting item text in a
Multi-Select wxTreeCtrl
Paul Gardella wrote:
Robin,
Thanks for replying.
I'm using Win2K with Python 2.2.2 and wxPython 2.4.0.2u.
To provide some sample code, I went to the wxTreeCtrl.py that comes with
the
wxPython demo and modified the tree to make it a multi-select. Then I
added
a line in the OnSelChanged() method to just set the item text on whatever
tree item is selected. When I ran it, I was unable to duplicate the
problem
exactly as I had been seeing it when running my code. I did, however, get
the AssertionError when I right-clicked on a tree item (putting me into
the
edit mode), then exited the edit mode by clicking either mouse button. No
exception when I exit edit mode by pressing the <Enter> key, only when I
exit edit mode by clicking either mouse button. File attached.
Please enter a bug report about this, with a category of wxMSW.
In your reply, you referred to dismissing an edit control. How do I do
that...by calling wxTreeCtrl::EndEditLabel()?
Yes.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
Regarding wxTreeCtrl::EndEditLabel(), the docs for wxPython 2.4.0.2u say
that it only works with MSW. Is that still true? If so, it could be a
problem, because some of my users are using Linux. Thanks.
Yes, but there was some discussion over the weekend about giving it an implementation for the other platforms.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
OK, I give up...how do I enter a bug? I clicked on "Report a bug" link on
the wxPython page, and it takes me to SourceForge. I log into SourceForge,
then I'm lost. Or I don't log into SourceForge...I'm still lost. Thanks.