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

SingleSelListBox empty area click

Oleg
Expert

From the Dialog Managet help:

"A mouse click on the empty client area of a list box (where there is no list item) removes all the previous selections."

 

This is true for a MultiSelListBox. But SingleSelListBox does not remove a selection.
I did not found any event to do this by code. 
( ListBoxClicked, ListBoxMouseDown, ListBoxSelectionChangeRequested, ItemMouseDown, ItemClicked dont filred )

Is there any trick ?

PS: Tried to force MultiSelListBox no more one selectection with no sucsess.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Oh yeah, you're right - it works on macOS but not Windows. Smells like a bug…

Ralph Wessel BArch
Central Innovation

View solution in original post

4 REPLIES 4

I've got a number of single selection lists and they seem to be acting correctly, i.e. clicking in a blank area deselects everything. Although I think we have tab controls mapped to list columns - possibly that makes it behave differently?

 

I also override DG::ListBoxObserver methods like ListBoxSelectionChanged (which fires when the blank are is clicked and checking the selected row returns 0). At this point the tab controls are refreshed and the list is redrawn. Possibly that's a factor?

Ralph Wessel BArch
Central Innovation
Oleg
Expert

Hello Ralph, thank you for reply.

Most of my tables have columns (tabfields) and often have ontab edit controls.
But click below rows into empty space dont clear a selection and ListBoxSelectionChanged did not fired.
Windows only. May be there is difference Mac-Win platforms ?

PS: And currently on this workplace I tried max AC26 API. 

Solution

Oh yeah, you're right - it works on macOS but not Windows. Smells like a bug…

Ralph Wessel BArch
Central Innovation
Oleg
Expert

Thnaks, I guess it may be not a bug, but a native listbox control feature.

Usually it is not big issue. But in one of my table with ontab controls I would like to clear selection (and remove ontab editing) for convenience.
Funny, the is no ListBoxSelectionChanged event, if do a click on already selected row, as a trick to remove selection.
So I found only one trick not very obvious to the user, but worked.

bool TableStageDelivery::ListBoxSelectionChangeRequested(const DG::ListBoxMouseDownEvent& ev)
{
	if (ev.GetSource() == &mi_list)
	{
		short item = ev.GetListItem();
		if (item == mi_list.GetSelectedItem())
		{
			mi_list.DeselectItem(item);
			OnSelectionChanged(true);
			return true;
		}
	}

	return false;
}




Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!