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 »

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 4456 times
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: add button into listbox

Post by doublemax »

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 »

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 4439 times
eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: add button into listbox

Post by eranif »

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 »

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: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: add button into listbox

Post by eranif »

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 »

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