UltimateListCtrl checkbox first row

217 views
Skip to first unread message

Stefanie Lück

unread,
Aug 23, 2011, 6:55:05 AM8/23/11
to wxPython-users
Hello!

Is there a simple way to add a first row with checkboxes ( like in
CheckListCtrlMixin) in an UltimateListCtrl ?

Thanks

Andrea Gavana

unread,
Aug 23, 2011, 2:04:46 PM8/23/11
to wxpytho...@googlegroups.com
Hi Stefanie,

Not as directly as in CheckListCtrlMixin, as I don't think the mixin
will work out of the box with UltimateListCtrl. However, simply
calling something like:

list.InsertStringItem(index, "text", 1)

Or

list.InsertImageStringItem(index, "text", image_id, 1)

Every time you need to add a new item should do the trick. Another
possible way would be to write a mixin for ULC as well (hint hint ;-)
). Otherwise, if I'll ever find the time I'll try to write one myself.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

>>> import PyQt4.QtGui
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ImportError: No module named PyQt4.QtGui
>>>
>>> import pygtk
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ImportError: No module named pygtk
>>>
>>> import wx
>>>
>>>

Stefanie Lück

unread,
Aug 24, 2011, 3:18:43 AM8/24/11
to wxPython-users
Thanks Andrea! CheckListCtrlMixin didn't work out of the box.
Thanks for your suggestions!
Stefanie

Stefanie Lück

unread,
Aug 24, 2011, 3:24:28 AM8/24/11
to wxPython-users
I would like to help and to support the great work of wxPython and
esp. your nice libraries but I don't know how. Are there any manuals
for writing / improving widgets? Up to know I was only lazy user not
developer :-)

Andrea Gavana

unread,
Aug 24, 2011, 6:32:25 AM8/24/11
to wxpytho...@googlegroups.com
Hi Stephanie,

On 24 August 2011 09:24, Stefanie Lück wrote:
> I would like to help and to support the great work of wxPython and
> esp. your nice libraries but I don't know how. Are there any manuals
> for writing / improving widgets? Up to know I was only lazy user not
> developer :-)

There is really no manuals as far as I know, I normally just use my
imagination ;-) . However, if I were you, I would use the
CheckListCtrlMixin as a starting point to implement a similar
functionality for ULC. That said, it should much easier to do it for
ULC because it already has embedded support for checkboxes and
radiobuttons.

Other than that, I will be more than happy to apply a patch improving
the behaviour of ULC (or any other AGW component).

Stefanie Lück

unread,
Aug 24, 2011, 7:26:11 AM8/24/11
to wxPython-users
Sorry, Andrea my question was not really clear.
I rather meant things like patch format, who to contact, where to
upload...
Stefanie

Andrea Gavana

unread,
Aug 24, 2011, 8:16:57 AM8/24/11
to wxpytho...@googlegroups.com
Hi Stephanie,

On 24 August 2011 13:26, Stefanie Lück wrote:
> Sorry, Andrea my question was not really clear.
> I rather meant things like patch format, who to contact, where to
> upload...

OK, I understand it now (sorry I am a bit slow today...). If we
suppose you want to improve an existing widget (let's say ULC), this
is what I would do if I were you:

1) Get the latest SVN revision for that widget, using tools like
TortoiseSVN (Windows), PySVN (all platforms?), from here:

http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW/agw/ultimatelistctrl.py

2) Make your modifications and add code to the file you just got from SVN;
3) Using the same SVN tools I mentioned above, create a patch against
the SVN version of ULC (in TortoiseSVN, for example, you right-click
the file you modified and select "Create patch"). On other platforms,
you can simply use unified diff to create a diff between the SVN
version and your revised file;
4) Create a ticket on wxTrac:

http://trac.wxwidgets.org/

Assigning as Component=AGW, type=enhancement and maybe throw in my
username (Infinity77) as owner of the ticket. Attach your patch to the
ticket. Everyone on wx-dev gets notifications about new tickets from
wxTrac, so I'll see it for sure. I'll review your patch and, unless it
contains something very weird, I'll simply apply it and commit a new
revision to SVN.

an alternative to that (which lets you skip steps 3 and 4) is simply
to send me your updated file and I'll make the necessary steps to
update it into SVN Obviously the drawback of this is that I will have
more work to do, and this is why wxTrac exists in the first place ;-)

Stefanie Lück

unread,
Aug 24, 2011, 9:13:41 AM8/24/11
to wxPython-users
Thanks Andrea! This made things much more clear to me and motivates to
help.
Maybe an entry in the wxpython wiki would be useful also for others!?
For hardcore developers these things are clear, but for "just a user"
like me, such procedure is sometimes a black box :-)
Sunny Greetings!

On 24 Aug., 14:16, Andrea Gavana <andrea.gav...@gmail.com> wrote:
> Hi Stephanie,
>
> On 24 August 2011 13:26, Stefanie Lück wrote:
>
> > Sorry, Andrea my question was not really clear.
> > I rather meant things like patch format, who to contact, where to
> > upload...
>
> OK, I understand it now (sorry I am a bit slow today...). If we
> suppose you want to improve an existing widget (let's say ULC), this
> is what I would do if I were you:
>
> 1) Get the latest SVN revision for that widget, using tools like
> TortoiseSVN (Windows), PySVN (all platforms?), from here:
>
> http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW/agw/ultimatelis...

Tobias Weber

unread,
Aug 24, 2011, 11:59:53 AM8/24/11
to wxpytho...@googlegroups.com
Hi all,

I am struggling w/ not being able to figure out how to bind the click on
the differnt columns of a ListCtrl to different events.

I went through the differnt ListCtrls and sure found general triggering
of ebents on a column as expected but not different events.

This is roughly what I have (simplyfied):

list = CheckListCtrl(self)
sizer = wx.BoxSizer()
sizer.Add(list, 1, wx.EXPAND)
self.SetSizer(sizer)
list.InsertColumn(0, "Model")
list.InsertColumn(1, "Type", wx.LIST_FORMAT_RIGHT)
list.InsertColumn(2, "Format", wx.LIST_FORMAT_RIGHT)
self.Bind(wx.EVT_LIST_COL_CLICK, self.OnFormat, list)


so now OnFormat gets triggered just fine- but I want to trigger OnType like:
self.Bind(wx.EVT_LIST_COL_CLICK, self.OnType, list)


Thanks

Robin Dunn

unread,
Aug 25, 2011, 1:38:03 PM8/25/11
to wxpytho...@googlegroups.com

Just make your EVT_LIST_COL_CLICK be a dispatcher. IOW have it get the
column that was clicked and then call another method based on which
column it was.


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

Reply all
Reply to author
Forward
0 new messages