Can I display a popup on a toolbar right bar command?

17 views
Skip to first unread message

mcw

unread,
Aug 23, 2019, 3:00:33 PM8/23/19
to CodenameOne Discussions
I have added a command to the toolbar:

getToolbar().addCommandToRightBar(_clearCommand);  

The command contains an icon only.

What I would like to do is handle a long press and display a popup that describes the functionaility.

The problem I am running into is that the toolbar needs a command and I need a component to detect the long press and display the popup dialog.

How can I do this?

Thanks,

Martin

Shai Almog

unread,
Aug 24, 2019, 12:35:00 AM8/24/19
to CodenameOne Discussions
Hi,
you can use toolbar.findCommandComponent(command); This will return a button to which you can bind a long press listener.

mcw

unread,
Aug 24, 2019, 3:32:36 PM8/24/19
to CodenameOne Discussions
Thanks, that worked well.

I had actually looked for a get method that would return the button, I can't believe I mist the find method, it was right there :-)
Reply all
Reply to author
Forward
0 new messages