wxListCtrl

Hello,

I'm in troubles with wxListCtrl widget: I can't populate it.
Here is part of my code:

    # Init
    self.playlistList = wxListCtrl(self.playlistListPanel,
                                   ID_PLAYLISTLIST,
                                   style=wxLC_REPORT|wxSUNKEN_BORDER)
    self.playlistList.InsertColumn(0, "Name")
    self.playlistList.InsertColumn(1, "Time")
    self.playlistList.SetColumnWidth(0, 250)
    self.playlistList.SetColumnWidth(1, 80)
    self.__currentIndex = 0

def __addPlaylist(self, playlist):
    """Add a playlist in the wxListCtrl playlistList."""
    self.playlistList.InsertStringItem(self.__currentIndex,
                                       playlist.name)
    self.playlistList.SetStringItem(self.__currentIndex, 1,
                                    playlist.getTime().toString())
    self.__currentIndex += 1

This wxListCtrl is in a splitter.
When I launch my app, the splitter hide my wxListCtrl. But if I drga the
splitter, I can see it.
Once I have populated my wxListCtrl, first I can't see anything in it (but
the items are there, because I can move the selection). And if I move the
splitter, the column headers go away !!!

I put 2 images to show the problem.

Any idea ?

snapshot2.png

snapshot1.png

···

--
   Frederic

   http://linux.gbiloba.org

Frederic wrote:

Hello,

I'm in troubles with wxListCtrl widget: I can't populate it.
Here is part of my code:

    # Init
    self.playlistList = wxListCtrl(self.playlistListPanel,
                                   ID_PLAYLISTLIST,
                                   style=wxLC_REPORT|wxSUNKEN_BORDER)
    self.playlistList.InsertColumn(0, "Name")
    self.playlistList.InsertColumn(1, "Time")
    self.playlistList.SetColumnWidth(0, 250)
    self.playlistList.SetColumnWidth(1, 80)
    self.__currentIndex = 0

def __addPlaylist(self, playlist):
    """Add a playlist in the wxListCtrl playlistList."""
    self.playlistList.InsertStringItem(self.__currentIndex,
                                       playlist.name)
    self.playlistList.SetStringItem(self.__currentIndex, 1,
                                    playlist.getTime().toString())
    self.__currentIndex += 1

This wxListCtrl is in a splitter.
When I launch my app, the splitter hide my wxListCtrl. But if I drga the splitter, I can see it.
Once I have populated my wxListCtrl, first I can't see anything in it (but the items are there, because I can move the selection). And if I move the splitter, the column headers go away !!!

What are self and self.playlistListPanel, and where in the window heirarchy is the splitter?

A complete sample that shows the problem would help solve this.

···

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

I attached the complete source (missing the Borg 'Yampp', which return
some infos). And a screesnhot showing the hierarchy (from wxGlade).

mainframe.py (4.65 KB)

···

On Friday 03 October 2003 22:17, Robin Dunn wrote:

What are self and self.playlistListPanel, and where in the window
heirarchy is the splitter?

A complete sample that shows the problem would help solve this.

--
   Frederic

   http://linux.gbiloba.org

Shame on me !!! I used ClearAll() instead of DeleteAllItems() !!! It
couldn't work.

I'm switching from FXPy (the python FOX wrapper) to wxWindows, and under
FXPy, DeleteAllItems() <=> clearAll()...

Sorry for the noise :o(

···

On Friday 03 October 2003 22:05, Frederic wrote:

Once I have populated my wxListCtrl, first I can't see anything in it
(but the items are there, because I can move the selection). And if I
move the splitter, the column headers go away !!!

--
   Frederic

   http://linux.gbiloba.org