add button into listbox Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
An.sir
Earned a small fee
Earned a small fee
Posts: 11
Joined: Mon Jan 13, 2014 9:26 am

add button into listbox

Post by An.sir » Mon Jan 13, 2014 10:21 am

hi, I want to write a component looks like the pic.

I don't know how to add buttons into the listbox.

how to add?
QQ图片20140113171258.jpg
QQ图片20140113171258.jpg (8.89 KiB) Viewed 1879 times

User avatar
doublemax
Moderator
Moderator
Posts: 15181
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: add button into listbox

Post by doublemax » Mon Jan 13, 2014 11:54 am

This is not possible with wxListBox. Alternatives could be wxGrid or wxPropertyGrid.
Use the source, Luke!

An.sir
Earned a small fee
Earned a small fee
Posts: 11
Joined: Mon Jan 13, 2014 9:26 am

Re: add button into listbox

Post by An.sir » Tue Jan 14, 2014 2:02 am

doublemax wrote:This is not possible with wxListBox. Alternatives could be wxGrid or wxPropertyGrid.
Thank you!
In fact, this is a part of the Cocostudio. From the follow picture I think the main frame of the component might be treectrl. Each item of it has two buttons(show/hide and lock/unlock). When the select an item there is a selection box and the items could be COLLAPSED and EXPANDED if they have child items. I wanted to write a container like this, can you tell me how to implement?
QQ图片20140114093514.jpg
QQ图片20140114093514.jpg (48.12 KiB) Viewed 1862 times

eranif
Moderator
Moderator
Posts: 607
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: add button into listbox

Post by eranif » Tue Jan 14, 2014 2:49 pm

You should implement this using wxDataViewCtrl with some custom rendering

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

An.sir
Earned a small fee
Earned a small fee
Posts: 11
Joined: Mon Jan 13, 2014 9:26 am

Re: add button into listbox

Post by An.sir » Wed Jan 15, 2014 3:09 am

eranif wrote:You should implement this using wxDataViewCtrl with some custom rendering

Eran
I think so
But could you tell me some details about how to add buttons and where should I handle the events of these buttons
Thank you

eranif
Moderator
Moderator
Posts: 607
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: add button into listbox

Post by eranif » Wed Jan 15, 2014 6:01 am

Have a look at the dataview example in wxWidgets source tree.
Specifically, you should have a look at this class:

http://docs.wxwidgets.org/stable/classw ... derer.html

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

An.sir
Earned a small fee
Earned a small fee
Posts: 11
Joined: Mon Jan 13, 2014 9:26 am

Re: add button into listbox

Post by An.sir » Thu Jan 16, 2014 6:25 am

eranif wrote:Have a look at the dataview example in wxWidgets source tree.
Specifically, you should have a look at this class:

http://docs.wxwidgets.org/stable/classw ... derer.html

Eran
Thank you! I understand now.

Post Reply