wxListCtrl w/ checkbox
wxListCtrl w/ checkbox
Hi all,
I know (ok, I strongly suspect) there is a way to put a checkbox control as an item in a (report style) list control, and have seen a items indicating that it worked in wxPython, but I need a C++ List Control with a checkbox.
If someone has solved this problem, would you be so kind as to share? Or if someone has a few hints, please let me know.
Thanks!
-rz.
I know (ok, I strongly suspect) there is a way to put a checkbox control as an item in a (report style) list control, and have seen a items indicating that it worked in wxPython, but I need a C++ List Control with a checkbox.
If someone has solved this problem, would you be so kind as to share? Or if someone has a few hints, please let me know.
Thanks!
-rz.
-rz.
----------------------
"Like so many Americans, she was trying to construct a life that made sense from things she found in gift shops." -- Kurt Vonnegut.
-----------------------
----------------------
"Like so many Americans, she was trying to construct a life that made sense from things she found in gift shops." -- Kurt Vonnegut.
-----------------------
It is *almost* exactly what I need, but I need multiple columns (ala report style list control). Can I add columns to the wxCheckListBox?
-rz.
----------------------
"Like so many Americans, she was trying to construct a life that made sense from things she found in gift shops." -- Kurt Vonnegut.
-----------------------
----------------------
"Like so many Americans, she was trying to construct a life that made sense from things she found in gift shops." -- Kurt Vonnegut.
-----------------------
I think your best guess is use a wxGrid or wxSheet for the columns and set one of the cells to a boolean cell, which represents the checkbox.
- Jorgen
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
-
- Earned some good credits
- Posts: 120
- Joined: Sun Aug 29, 2004 3:09 pm
- Location: Grenoble, France
- Contact:
You can do it by derivate the wxListCtrl and handly add checkbox placement.
You just have to handle size and scroll event and use GetItemRect/GetItemPosition functions to retrieve item position and move checkbox consequently.
Tip : you can store checkbox address in the ListItem extra data.
You just have to handle size and scroll event and use GetItemRect/GetItemPosition functions to retrieve item position and move checkbox consequently.
Tip : you can store checkbox address in the ListItem extra data.
What is little and green, witch go up and down ??
Yoda playing with the force.
Yoda playing with the force.
rz is making an important point here. wxListCtrl lacks a widely used property of the Win32 ListView control in report mode. (Win32 even offers convenience functions for checking and unchecking items.)
I wrote my own wrapper for a Win32 ListView a while back (before I discovered wxWidgets!) and it's very easy to implement checkbox list views on Windows:
My problem is that I have no experience creating as opposed to using components in wxWidgets.
In short, this is something that would be a valuable addition to the standard wxListCtrl and well worth folding back into the main distribution.
I wrote my own wrapper for a Win32 ListView a while back (before I discovered wxWidgets!) and it's very easy to implement checkbox list views on Windows:
Code: Select all
/*
// ctrlHwnd is of type HWND
SendMessage(
ctrlHwnd,
LVM_SETEXTENDEDLISTVIEWSTYLE,
0,
LVS_EX_CHECKBOXES);
*/
void ListViewControl::setCheckState(bool b, int item)
{
ListView_SetCheckState(ctrlHwnd, item, (b) ? TRUE : FALSE);
}
In short, this is something that would be a valuable addition to the standard wxListCtrl and well worth folding back into the main distribution.
-
- Can't get richer than this
- Posts: 802
- Joined: Mon Dec 27, 2004 10:46 am
- Location: Estonia, Tallinn
- Contact:
It would be a valuable addition to a new control.
wxListCtrl API is too windows centric to do anything on top of it on other platforms, while staying sane.
Now for that new control there would be help most appreciated.
wxListCtrl API is too windows centric to do anything on top of it on other platforms, while staying sane.
Now for that new control there would be help most appreciated.
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD
Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/
OS's: Gentoo Linux, WinXP; WX: CVS HEAD
Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/
Download file webupdate-1.0.tar.gz (from http://wxcode.sourceforge.net/components/webupdate/) there is a class named wxCheckedListCtrl (files checkedlistctrl.h/cpp)