Where to find a enhancement ListView with checkbox? 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
ChineseAlexander
Earned some good credits
Earned some good credits
Posts: 110
Joined: Fri Mar 31, 2006 6:05 am

Where to find a enhancement ListView with checkbox?

Post by ChineseAlexander » Fri Oct 20, 2006 3:55 am

I write a ListView which derived from wxListView, but it works not very well. I want to add a checkbox, and in Windows Version I want the every row with skyblue and white just like iMac Style. But In wxWidgets2.6.3, It works so ugly. Waiting for your help.thx

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Fri Oct 20, 2006 7:15 am

Currently the standard listview is a beast and limited. There are other controls that you might try. wxTeeListCtrl but I am not sure if it does checkboxes, wxDataViewCtrl is underway, which will be a huge improvement because it combines the best of both worlds. Treeviews, listviews and grids plus owner drawn functionality.

You might be able to create a wxListCtrl derived class fakes the checkbox by drawing a picture and catching a mouse up on the column to see if you checked or cleared the box. I'm pretty sure this is done befor, hopefully someone else can give you a more satisfying answer. Have you tried looking at wxCode?

Regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Fri Oct 20, 2006 8:02 am

a wxCheckedListCtrl is available on wxCode within the wxWebUpdate component (IIRC).

ChineseAlexander
Earned some good credits
Earned some good credits
Posts: 110
Joined: Fri Mar 31, 2006 6:05 am

Post by ChineseAlexander » Fri Oct 20, 2006 8:58 am

benedicte wrote:a wxCheckedListCtrl is available on wxCode within the wxWebUpdate component (IIRC).
Yes,I have seen the Application,and It does has the CheckBox.
But unluckily, I can't find the Source Code. It does not opensourced ?

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Fri Oct 20, 2006 9:37 am

When you download the component source code, you can extract a .h/.cpp file for this class.

ChineseAlexander
Earned some good credits
Earned some good credits
Posts: 110
Joined: Fri Mar 31, 2006 6:05 am

Post by ChineseAlexander » Mon Oct 23, 2006 2:22 am

benedicte wrote:When you download the component source code, you can extract a .h/.cpp file for this class.
Maybe I have wrong place to download, can you give me just a link, thanks very much!

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Mon Oct 23, 2006 7:16 am

WebUpdate at wxCode.
Click on the "download" link, then look for "webupdate" in the list of components.
Get the Platform-independant package (sources), extract the files on your computer.
The .h file is located in /include/wx. The .cpp file is in /src.

chrismcb
Knows some wx things
Knows some wx things
Posts: 26
Joined: Fri Nov 02, 2007 11:58 am

Post by chrismcb » Thu Jun 12, 2008 10:49 am

I started down the right of just creating a new column and placing the check image in the new column.

Problem is how can I figure out if the column has been clicked on? Can I get this information? Or at least find out where the mouse was when the event was triggered?

Frank
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 211
Joined: Sat Jan 01, 2005 6:19 pm

Post by Frank » Thu Jun 12, 2008 1:43 pm

wxCheckListBox is part of wxWidgets.

It was in 2.6.3 alrady.

See:
http://docs.wxwidgets.org/2.6.3/wx_wxch ... ecklistbox

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Thu Jun 12, 2008 5:39 pm

wxCheckListBox is not the same as one based upon wxListCtrl. Plus that there is a severe flaw in wxCheckListBox that renders it useless. The creator used the client data entry for the check state. Which renders it completely useless for applications that reference a data class per item that is listed in the listbox.

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

chrismcb
Knows some wx things
Knows some wx things
Posts: 26
Joined: Fri Nov 02, 2007 11:58 am

Post by chrismcb » Fri Jun 13, 2008 10:31 am

wxCheckListBox is derived from wxListBox, not wxListCtrl. It doesn't provide multi column support.

Of course I could quickly check wxListCtrl to support Window's version of the checkbox ctrl, but I was hoping not to have to do that.

The route I have taken so far seems the most promising, and should be fairly trivial to implement if I can figure out if the first column is the one clicked on. This is information I should have at my disposal. I would have assumed this sort of data (the x,y of the mouse) would be in the event, but it isn't. I guess I can call wxGetMousePosition and compare it.

And yes I want to treat selecting the row (clicking on anything other than the first column) different than clicking on the checkbox (which for now is the first column)

Or I can change the code to pass the flag onto Windows and get it on windows for free.

chrismcb
Knows some wx things
Knows some wx things
Posts: 26
Joined: Fri Nov 02, 2007 11:58 am

Post by chrismcb » Fri Jun 13, 2008 11:50 am

Ok After doing some more investigation I've discovered:
wxEVT_COMMAND_LEFT_CLICK Is forwarded on. BUT no useful information is included with the Event. The enitre data structure passed by Windows is ignored (which includeds which item and subitem were clicked on)

I guess I'll do what others have down and add a watch for the mouse down and call hittest.

Post Reply