Home Download Buy Blog Forum Support

Checking selected menu items

Checking selected menu items

Postby virgil_disgr4ce on Wed Mar 07, 2012 10:14 pm

How do we make a menu item "checkable," as in, selected, and keep the state of that selection?
virgil_disgr4ce
 
Posts: 3
Joined: Wed Mar 07, 2012 7:41 pm

Re: Checking selected menu items

Postby jps on Thu Mar 08, 2012 12:08 am

You'll need 2185 or later for this to work, although it's not out yet. When it is, you'll need to:

- Implement is_checked in your plugin
- Add "checkbox": true to the corresponding entry in the .sublime-menu file
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: Checking selected menu items

Postby C0D312 on Thu Mar 08, 2012 12:10 am

You'll need 2185 or later for this to work, although it's not out yet.


Oh Jon, you're such a tease.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Checking selected menu items

Postby Kor on Tue Jul 31, 2012 1:14 pm

hi,

how exactly do I need to implement is_checked? I've looked around the docs, but it appears nowhere.

Thanks, mates
Hey! I made Andrew, the Android plugin development!
Kor
 
Posts: 6
Joined: Tue May 29, 2012 9:09 am

Re: Checking selected menu items

Postby dbachrach on Tue Jul 31, 2012 8:33 pm

class MyCheckableCommand(sublime_plugin.WindowCommand):
def run(self):
pass # do something

def is_checked(self):
return True # or False
dbachrach
 
Posts: 4
Joined: Wed Jan 25, 2012 9:49 pm

Re: Checking selected menu items

Postby Kor on Tue Jul 31, 2012 10:11 pm

I couldn't figure out how to get the current value from the menu entry! Really, really thank you! My problem was I tried that entry without a command, and it was behaving like a checkbox, and I expected I should grab the value, not override it with is_checked!

Thank you again =)
Hey! I made Andrew, the Android plugin development!
Kor
 
Posts: 6
Joined: Tue May 29, 2012 9:09 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 10 guests