> I tried something like this:
>
> <snip>
> def more_menu_items(keywords):
> # A very static "dyanamic menu" just for testing
> return [("|", None)]
>
> c.context_menus['iconbox'] = [
> ('*', more_menu_items),
> ]
> </snip>
Thanks for this Kayvan, it's a big help when people can show me the
bits they don't understand. I've added a couple of executable howto's
to the testLeoPlugin, one of which covers your needs, and I'll push it
to mod_rclick soon.
Meanwhile I'll explain. The last part is ok but the function should
be ...
def more_menu_items(keywords):
menu_table = keywords['rc_menu_table']
new_items = [
('Label One', 'some-command'),
('|', None),
('Label Two', 'some-other-command'),
]
menu_table[:0] = new_items
When the menu builder sees your ('*', more_menu_items) item it calls
more_menu_items with the list of items
that it has not yet built (ie all those items following yours) in
keywords['rc_menu_table']. ( In this case the list will be empty as
there are no more items.
You can alter this list in any way you want but in-situ, you can not
replace the list. I may change this later if people think it is too
much of a restriction.
By the way, the '|' is used to start a new column it can not be used
on it's own or before a separator item, only before a proper menu
item.
Happy programming
Bob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---