Hi all
I have a wx.listctrl, which is bound to fire self.update() when ever the focused item changes.
My question is, I have three lists:
self.year,
self.month
and self.day
I can get the focussed item number: self.year.GetFocusedItem()
but How do I get that items text, so instead of it telling me that item 0 is focused, it tells me that 2018 is focused.
Thanks a lot
Nate
Nate,
It looks like the documentation may need some clarification on the
distinction between an Item and an Item Index or ID - unless I am
misreading:
item_index = self.year.GetFocusedItem()
if item_index != -1:
txt = self.year.GetItem(item_index).GetItemText()
Should do the job.
The demo code uses:
def OnItemSelected(self, event):
##print(event.GetItem().GetTextColour())
self.currentItem = event.Index
self.log.WriteText("OnItemSelected: %s, %s, %s, %s\n" %
(self.currentItem,
self.list.GetItemText(self.currentItem),
self.getColumnText(self.currentItem, 1),
self.getColumnText(self.currentItem, 2)))
in the wx.EVT_LIST_ITEM_SELECTED handler. Changing the 3rd line to:
self.currentItem = self.list.GetFocusedItem() #event.Index
still works nicely.
···
On 16/09/2018 11:34, Nathan smith wrote:
Hi all
I have a wx.listctrl, which is bound to fire self.update() when ever the
focused item changes.
My question is, I have three lists:
self.year,
self.month
and self.day
I can get the focussed item number: self.year.GetFocusedItem()
but How do I get that items text, so instead of it telling me that item
0 is focused, it tells me that 2018 is focused.
Thanks a lot
Nate
--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.
---
This email has been checked for viruses by AVG.