Checkmark in submenu list when using GetSubContainer



  • Hi everyone!

    When adding entries to a custom menu via the GetSubContainer function of the commandData class I get a weird check mark when adding an entry to position 0. The first entry is also not clickable.

    def GetSubContainer(self, doc, submenu):
        submenu.SetString(0, "Entry1")
        submenu.SetString(1, "Entry2")
        submenu.SetString(2, "Entry3")
        return True
    

    0_1547733244270_weird checkmark.png

    I realize, that I can simply move up the indices by one and the result looks correct.

    def GetSubContainer(self, doc, submenu):
        submenu.SetString(1, "Entry1")
        submenu.SetString(2, "Entry2")
        submenu.SetString(3, "Entry3")
        return True
    

    0_1547733535053_weird checkmark 2.png

    I was just wondering why this happens or what you would use it for. I'm guessing it has something to do with the commandData plugin, that is already inserted at position 0?

    Edit: This is just tangentially related, but: Is it possible to add a seperator between the entries that are created in GetSubContainer?



  • Hi,

    those first IDs are really special. As the documentation for GetSubContainer() states, for example ID 1 in the sub-container is used to name the sub-menu. To be honest I didn't check, why ID zero is also special. But I think, you will be fine, using IDs beginning from 1000 as also shown in the code snippets in the documentation.

    We will try to make the documentation more clear in this regard. Sorry for the inconvenience caused.

    Cheers,
    Andreas



  • Thanks Andreas!
    That clears that up :)

    I have another question related to submenus. But since you guys like to keep things seperate I'll open a new thread. (Hope that's appropriate)



  • Yes, that's appropriate. Thanks ☺


Log in to reply