Python menu Check

On 24/03/2014 at 12:23, xxxxxxxx wrote:

I am adding menu items to a python created window using:

self.MenuSubBegin("Set")
		self.MenuAddString(10017,"Local&c&")
		self.MenuSubEnd()
		

Trying to toggle the check mark on the menu I am using:

self.MenuInitString(10017,True,False)

Where in the documentation, False is where the check status goes. So false should be unchecked and true should be checked. I can not get the check to do anything.

Am I setting this up wrong?

On 24/03/2014 at 12:34, xxxxxxxx wrote:

I can confirm your problem. Looks like a bug, I'll forward this to the devs. You'll need to
flush the menu and re-build it.

Best,
-Niklas

On 24/03/2014 at 12:35, xxxxxxxx wrote:

Thanks!

On 25/03/2014 at 00:49, xxxxxxxx wrote:

The &c& always checks the entry. You have to rename or build a new menu. To check the menu remove the &c& and check it only with self.MenuInitString. If you need a check when the dialog opens use this function also in CreateLayout with checked=True. Hope this helps.

Cheers, s_rath

On 25/03/2014 at 01:11, xxxxxxxx wrote:

Thanks for the info, Sebastian. That explains why my tests didn't work, either.

import c4d
  
class Dialog(c4d.gui.GeDialog) :
  
    def CreateLayout(self) :
        self.MenuSubBegin("File")
        self.MenuAddString(1000, "Open ...")
        self.MenuAddString(1001, "Save ...")
        self.MenuAddString(1002, "Close")
        self.MenuInitString(1001, False, False)
        self.MenuInitString(1002, False, False)
        self.MenuSubEnd()
        self.MenuFinished()
        
        return True
  
    def Command(self, id, msg) :
        if id == 1000:
            self.MenuInitString(1001, True, False)
            self.MenuInitString(1002, True, False)
            self.MenuFinished()
        elif id == 1002:
            self.MenuInitString(1001, False, False)
            self.MenuInitString(1002, False, False)
            self.MenuFinished()
        return True
  
dlg = Dialog()
dlg.Open(c4d.DLG_TYPE_ASYNC)

Best,
-Niklas

On 25/03/2014 at 08:49, xxxxxxxx wrote:

Thanks for the help guys!