1

I am trying to find a way for a making a row both toggleable and having a dropdown menu if right click is clicked in Jetpack Compose Desktop.

Row( modifier = Modifier.height(IntrinsicSize.Min) .background(if (selected) MaterialTheme.colors.secondary else Color.Transparent) .mouseClickable( onClick = { if (this.buttons.isSecondaryPressed) { onRightMouseClick.invoke(index) } }) .toggleable( value = !selected, onValueChange = { onItemSelected.invoke(!selected, index) } ) ) 

Is there any way to consume both events at the same time? If i change the order of the modifiers, then the second one is always consumed.

1 Answer 1

1

After not finding an answer for quite some while, I decided to do the implementation a bit differently and have used the logic behind selection inside mouseClickable (not the best of solutions but a workaround at least).

Row( modifier = Modifier.height(IntrinsicSize.Min) .background(if (selected) MaterialTheme.colors.secondary else Color.Transparent) .mouseClickable( onClick = { if (this.buttons.isSecondaryPressed) { onRightMouseClick.invoke(index) }else{ onItemSelected.invoke(!selected, index) } }) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.