BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad C++ API
About Archicad add-on development using the C++ API.

How to add check boxes to List Box?

Anonymous
Not applicable
Hi,
Please tell me if it is possible to add checkboxes to the List Box?
I have a lot of categories that I want to group in a List Box. These categories are selected through standard checkboxes. Is it possible to add them in this form to the List Box?
1 REPLY 1
Miklos Vegh
Graphisoft
Graphisoft

Hi, the best way to show checkboxes on the listbox lines is to set the special icons defined in DGListBox.hpp with the ListBox::SetTabItemIcon (short listItem, short tabIndex, const DG::Icon& icon) member function. You can use these type of check icons:

	enum SpecialIcons {
		NoIcon			= DG_NO_ICON,
		DragIcon		= DG_LIST_DRAGICON,
		CheckedIcon		= DG_LIST_CHECKEDICON,
		UncheckedIcon		= DG_LIST_UNCHECKEDICON,
		MixedCheckedIcon	= DG_LIST_MIXEDCHECKEDICON,
		GrayCheckedIcon		= DG_LIST_GRAYCHECKEDICON,
		GrayUncheckedIcon	= DG_LIST_GRAYUNCHECKEDICON,
		GrayMixedCheckedIcon	= DG_LIST_GRAYMIXEDCHECKEDICON,
		FramelessCheckIcon	= DG_LIST_FRAMELESSCHECKICON,
		FramelessGrayCheckIcon	= DG_LIST_FRAMELESSGRAYCHECKICON
	};

Whenever the data changes, the corresponding icon should be set on the tabfield.

On a click event the dialog can determine from the click position whether the icon was clicked or not.

 

Here is an example:

list.SetTabItemIcon (rowIndex, checkColumn, DG::Icon (SysResModule, DG::ListBox::CheckedIcon));

 

Putting a checkbox item on the list row with the SetOnTabItem member function is not advised, because the checkbox controls have some background colored frame around which result a bit ugly lookout.

Learn and get certified!