wx.ListCtrl doesn't display items nor columns when style=wx.LC_REPORT on Windows

104 views
Skip to first unread message

leferreyra

unread,
Apr 24, 2012, 11:18:48 AM4/24/12
to wxPython-users
hi, it's me again..

when i set the style to wx.LC_LIST it display the items but only the
first column as spected, but when i set it to wx.LC_REPORT it doesnt
show the columns nor items... just the listcrtl empty

this only happens on windows, on linux everything runs perfect...

Here is the code http://github.com/leferreyra/w3bex-sgpd
In the ui.py file.. the class MyFrame.. ( it happens in all classes
with listctrls )

Thanks

Tim Roberts

unread,
Apr 24, 2012, 12:54:53 PM4/24/12
to wxpytho...@googlegroups.com
leferreyra wrote:
when i set the style to wx.LC_LIST it display the items but only the
first column as spected, but when i set it to wx.LC_REPORT it doesnt
show the columns nor items... just the listcrtl empty

this only happens on windows, on linux everything runs perfect...

You have this:
        self.list_todos.InsertColumn(-1, "No")
        self.list_todos.InsertColumn(
-1, "Cliente")
        self.list_todos.InsertColumn(
-1, "Productos")
        self.list_todos.InsertColumn(
-1, "Saldo", width=200)

        self.list_inactivos.InsertColumn(
-1, "No")
        self.list_inactivos.InsertColumn(
-1, "Cliente")
        self.list_inactivos.InsertColumn(
-1, "Productos")
        self.list_inactivos.InsertColumn(
-1, "Saldo", width=200)

        self.list_morosos.InsertColumn(
-1, "No")
        self.list_morosos.InsertColumn(
-1, "Cliente")
        self.list_morosos.InsertColumn(
-1, "Productos")
        self.list_morosos.InsertColumn(
-1, "Monto Atrasado", width=200)
        self.list_morosos.InsertColumn(
-1, "Saldo",width=200)

You are assuming that InsertColumn follows Python's rule that "-1" means "at the end".  That's not the case.
  InsertColumn maps to a C++ method that then maps to operating system APIs, where -1 is just an invalid column number.  Replace those with 0, 1, 2, 3 and I think you will find success.  Your columns started showing up for me.
-- 
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Robin Dunn

unread,
Apr 24, 2012, 1:12:41 PM4/24/12
to wxpytho...@googlegroups.com

Try passing an actual column number to InsertColumn instead of -1.


--
Robin Dunn
Software Craftsman
http://wxPython.org

Leonardo Ferreyra

unread,
Apr 24, 2012, 7:18:48 PM4/24/12
to wxpytho...@googlegroups.com
Perfect, Thanks
I'm very impressed with how quickly you respond.. Thanks again!

> --
> To unsubscribe, send email to wxPython-user...@googlegroups.com
> or visit http://groups.google.com/group/wxPython-users?hl=en

Reply all
Reply to author
Forward
0 new messages