Changing Command icon on state changes

26 views
Skip to first unread message

Bryan Buchanan

unread,
May 23, 2016, 4:12:52 AM5/23/16
to CodenameOne Discussions
Why doesn't the icon for the Command change when I click on the Command in an overflow menu ?

 
        im = FontImage.createMaterial(FontImage.MATERIAL_MODE_EDIT, UIManager.getInstance().getComponentStyle("Command"));
        sel
= FontImage.createMaterial(FontImage.MATERIAL_SNOOZE, UIManager.getInstance().getComponentSelectedStyle("Command"));
       
Command edit = new Command("Edit") {

           
@Override
           
public void actionPerformed(ActionEvent evt) {
               
System.out.println("Editing");
           
}
       
};
        edit
.setIcon(im);
        edit
.setPressedIcon(sel);
        edit
.setRolloverIcon(sel);
        home
.getToolbar().addCommandToOverflowMenu(edit);


Shai Almog

unread,
May 23, 2016, 11:57:00 PM5/23/16
to CodenameOne Discussions
Unlike other parts of the toolbar the overflow was implemented as a List which doesn't support state changes (it's specific to Button subclasses).

I think this is a mistake but it's non-trivial to fix.
Reply all
Reply to author
Forward
0 new messages