Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sections in MaterialPopupMenu public #55

Open
SasLuca opened this issue Apr 17, 2019 · 3 comments
Open

Make sections in MaterialPopupMenu public #55

SasLuca opened this issue Apr 17, 2019 · 3 comments

Comments

@SasLuca
Copy link

SasLuca commented Apr 17, 2019

I want to be able to modify the UI elements in the popup menu when the user clicks on them, however I can't do this right now because they private.

I think it would be better if they were public so that we could modify them or offer users a different way to modify them.

@zawadz88
Copy link
Owner

Hi @SasLuca,
I'm not sure if I understand this. Would like to be able to update the popup menu while it's still displayed without closing it? If so, how would it look like? What kind of modification do you have in mind?

@SasLuca
Copy link
Author

SasLuca commented Apr 17, 2019

Yeah, I would like to update the popup menu while it's still displaying without closing it. I now realise that is a bit harder to do.

Maybe there could be a refresh() function for MaterialPopupMenu that you would call within a callback like such:

var ct = 0

val popupMenu = popupMenu()
{
    section()
    {
        item()
        {
            label = "Counter: $ct"
            callback =
            {
                ct++
                label = "Counter: $ct"
                popupMenu.refresh()
            }
        }
    }
}

@zawadz88
Copy link
Owner

If you would like to refresh an individual label when clicked you could use a custom item, get a reference to a textview in that View and update it accordingly when clicked. Or do you have something else in mind?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants