menuitem with with icon [SOLVED]

On 14/12/2014 at 16:03, xxxxxxxx wrote:

hey

is there a way to get a menu item with an icon like self.MenuAddString(41, "name") so it can be checked and unchecked ?

thanks

On 15/12/2014 at 04:20, xxxxxxxx wrote:

Hi,
actually you are not talking about an icon, but you want to change the state of the menu entry (toggle between checked and unchecked).
You can do this with MenuInitString(id, enabled, value). This can also be used to en-/disable a menu entry.
See the docs here: Python SDK: GeDialog - MenuInitString

On 15/12/2014 at 06:26, xxxxxxxx wrote:

I like to add a image to that type of menu item - possible ?

On 15/12/2014 at 09:59, xxxxxxxx wrote:

Well, yes and no. Wink
I don't think there's a way to add an icon to a menu entry you install via MenuAddString().
But what you can do is to implement your commands as CommandData plugin and then use MenuAddCommand(). In this way the menu entry will get the command's icon.

On 15/12/2014 at 10:18, xxxxxxxx wrote:

This thread has an example of toggling between two images on a menu instead of using a check mark:

https://plugincafe.maxon.net/topic/7462/9284_change-icon-based-on-state-in-commanddata&KW=state_a&PID=36789#36789

-ScottA

On 15/12/2014 at 14:26, xxxxxxxx wrote:

great solution !