select listview item in 2.8.9.1

Hello!

I am trying to show selected item in ListView on Windows XP with the attached code.
It works well on Vista and Mac OS X, but on Windows XP I have to comment out self.pnl2 line to show selected item.

What to do?

Mind you, that I need self.pnl2 for other things not included in the example.

Boštjan

import wx
class DemoFrame(wx.Frame):
    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id) self.pnl2 = wx.Panel(self, -1,style=0)
        self.bes=wx.ListView(self,-1,size=(250,200),style=wx.LC_REPORT)
        self.bes.InsertColumn(0,u"title",width=250)
        grid=wx.GridBagSizer(hgap=1,vgap=1)
        grid.Add(self.bes,pos=(0,1))
               self.SetSizerAndFit(grid)
        self.Fit()
        self.bes.InsertStringItem(0,u"test")
        self.bes.InsertStringItem(0,u"test2")
        self.bes.InsertStringItem(0,u"test3") self.bes.Select(2)

app = wx.PySimpleApp()
frame=DemoFrame(parent=None,id=-1)
frame.Show()
app.MainLoop()

Boštjan Jerko wrote:

Hello!

I am trying to show selected item in ListView on Windows XP with the attached code.
It works well on Vista and Mac OS X, but on Windows XP I have to comment out self.pnl2 line to show selected item.

What to do?

Mind you, that I need self.pnl2 for other things not included in the example.

Boštjan

import wx
class DemoFrame(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id) self.pnl2 = wx.Panel(self, -1,style=0)
self.bes=wx.ListView(self,-1,size=(250,200),style=wx.LC_REPORT)
self.bes.InsertColumn(0,u"title",width=250)
grid=wx.GridBagSizer(hgap=1,vgap=1)
grid.Add(self.bes,pos=(0,1))
self.SetSizerAndFit(grid)
self.Fit()
self.bes.InsertStringItem(0,u"test")
self.bes.InsertStringItem(0,u"test2")
self.bes.InsertStringItem(0,u"test3") self.bes.Select(2)

app = wx.PySimpleApp()
frame=DemoFrame(parent=None,id=-1)
frame.Show()
app.MainLoop()

I'm confused. Are you wanting it to show the third item as selected when the program loads? Because it does on my Windows XP box, It's a light gray selection instead of the dark blue until I actually select the frame to bring it into focus.

I'm using XP SP3, Python 2.5.2 and wxPython 2.8.9.1. What are you using?

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Funny. I have exactly the same configuration and it doesn't show on my monitor. I am starting to suspect the monitor - I'll have to check on other Win XP.

Thank for the reply,

B.

···

On 3.11.2008, at 15:57, Mike Driscoll wrote:

I'm confused. Are you wanting it to show the third item as selected when the program loads? Because it does on my Windows XP box, It's a light gray selection instead of the dark blue until I actually select the frame to bring it into focus.

I'm using XP SP3, Python 2.5.2 and wxPython 2.8.9.1. What are you using?

Boštjan Jerko wrote:

Hello!

I am trying to show selected item in ListView on Windows XP with the attached code.
It works well on Vista and Mac OS X, but on Windows XP I have to comment out self.pnl2 line to show selected item.

What to do?

Mind you, that I need self.pnl2 for other things not included in the example.

Boštjan

import wx
class DemoFrame(wx.Frame):
   def __init__(self,parent,id):
       wx.Frame.__init__(self,parent,id) self.pnl2 = wx.Panel(self, -1,style=0)
       self.bes=wx.ListView(self,-1,size=(250,200),style=wx.LC_REPORT)
       self.bes.InsertColumn(0,u"title",width=250)
       grid=wx.GridBagSizer(hgap=1,vgap=1)
       grid.Add(self.bes,pos=(0,1))
             self.SetSizerAndFit(grid)
       self.Fit()
       self.bes.InsertStringItem(0,u"test")
       self.bes.InsertStringItem(0,u"test2")
       self.bes.InsertStringItem(0,u"test3") self.bes.Select(2)

app = wx.PySimpleApp()
frame=DemoFrame(parent=None,id=-1)
frame.Show()
app.MainLoop()

What are you using pnl2 for? Was it intended to be the parent of the ListView?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Not that ListView.
The program is intented to be sort of a video player and in pnl2 I add a subtitle using TextCtrl.

Boštjan

···

On 4.11.2008, at 1:06, Robin Dunn wrote:

What are you using pnl2 for? Was it intended to be the parent of the ListView?

Boštjan Jerko wrote:

What are you using pnl2 for? Was it intended to be the parent of the ListView?

Not that ListView.
The program is intented to be sort of a video player and in pnl2 I add a subtitle using TextCtrl.

In that case then you should add the panel to the sizer. The problem is probably related to the panel ending up overlapping the listctrl or something like that. Putting it in the sizer will make sure it is not overlapping anything else in the sizer.

···

On 4.11.2008, at 1:06, Robin Dunn wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!