Re: [code] Textadept: adding a top-level menu?

From: Mitchell <m.att.foicica.com>
Date: Fri, 2 Nov 2018 15:28:01 -0400 (EDT)

Hi Phil,

On Fri, 2 Nov 2018, Phil S. wrote:

> I bought & enjoyed the 'Textadept Quick Reference' but I'm wrestling
> hopelessly with the seemingly-simple wish to add own top-level menus. That is
> obviously *without* cumbersomely copying the original 577-line menu.lua to my
> ~/.textadept/modules/textadept and tweaking it in a few places.
>
> The QuickReference has handy examples to easily extend *existing* menus but I
> can't figure out how to integrate custom top-level menus to the menubar.
> Anyone know of a snippet or existing module out there that does this, so one
> can learn? Even the listed extensions in the Wiki that mention menus tend to
> only add items or sub-menus to already-existing top-level-menus.

Just treat `textadept.menu.menubar` like a normal table.

From the command entry I was able to enter this:

textadept.menu.menubar[#textadept.menu.menubar + 1] = {title='Hi',{'Foo',function()ui.print('Bar')end}}

It appended a 'Hi' menu after 'Help'.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Fri 02 Nov 2018 - 15:28:01 EDT

This archive was generated by hypermail 2.2.0 : Sat 03 Nov 2018 - 06:42:09 EDT