Custom component in ListBox

Hey friends…

In one "Acomponent " implements ListBoxModel, has one listBox inside it.
Now Component * refreshComponentForRow (int rowNumber, bool isRowSelected, Component *existingComponentToUpdate) is implemented to put custom component “BComponent” in listBox.

Other implemented methods are, listBoxItemClicked and getDragSourceDescription

When My “Acomponent” was without Component * refreshComponentForRow (int rowNumber, bool isRowSelected, Component *existingComponentToUpdate) is implemented to put custom , it was calling back other methods like listBoxItemClicked and getDragSourceDescription when selection changes and drag happen.

:?: But now with custom “BComponent” , they are not getting called back, and why ? Does it to me managed from “BComponent” only by calling ownerAcomponent’s different methods ? Or which messages can be useful here to get other methods called like when another “BComponent” selected and dragged :?:

Thank you buddies …

Well listBoxModel as owner helped me lot for every selection.

But can anyone please help me on following.

TreeView with multiple selection enable, and it has TreeViewItem custom component using createItemComponent.
Now when mouseDown, mouseUp, should send back selection using
setSelected(!isSelected(), false),
But this is causing problem that it does not clear other Items selected earlier,
I know setSelected(!isSelected(), true) can give me other items cleared.

But can any one tell me , How to detect ctrl keyboard key down if i want to select multiple items.
mouseDown(MouseEvent & e)
// if ctrl key down (means multi selection)
setSelected(!isSelected(), false);
// else single item selected
setSelected(!isSelected(), true);

Please reply

Hi fellas,

Started with KeyListener and it’s keyEvent(key, component) method.
But very simple solution is following, hope it could help others.

In custom component of TreeViewItem
If TreeViewItem’s ownerTreeView has isMultiSelectionEnabled() then
Just simple need to check into custom component’s
mouseDown(MouseEvent & e)
// Great work here From Juce(Thanks) - Lots of needed stuff inside MouseEvent’s Mods
// Bingo do it for multiple selection
// Just normal selection process
// But careful here need to check whether treeView has multiple items selected already (act accordingly)

Have Fun.