PathActionQMenu:
Filter:
Classes (extension) | GUI > Views | Libraries > jostMlib

PathActionQMenu
ExtensionExtension

A Button with a popup Menu for performing actions on file paths.
Location: NOT INSTALLED!

Description

An ActionQMenu, where string entries are interpreted as file/folder paths.

A folder works multi-level, listing subfolders.

You can still add \key->action associations,ActionQSubMenu,or a MenuAction just like in ActionQMenu.

Closes on click outside or on escape key.

Class Methods

.new

Create an ActionMenu

Arguments:

parent

The parent view.

bounds

A Rect

name

The Menu Button Title

items

An Array of String, Association (\key->function), MenuAction, or ActionQSubMenu.

NOTE: items

A String is interpreted as file or folder paths (except if they start with "-");

A String ending in "/*" will iterated over the files in the directory on the top level.

If a String starts with "-", it creates a menu separator.

Use an Association to trigger the associated function (and globalAction).

Use a MenuAction to customize all aspects of the menu, and trigger the associated action (and globalAction).

Use a ActionQSubMenu to create a sub-menu.

defaultAction

a default action, in case not action is specified.

globalAction

a global action which is run for any item.

useDefaultFont

if your item is a , override its font with menu font. defaults to true. If you want to completely customize MenuAction items, set it to false;

lazyLoad

default: defaultLazyLoad. lazy load the submenus. False makes menu items more respnsive.

Caution: false can slow things down with large directories and subdirectories.

showArrow

show a little down-tick arrow, defaults to true

Returns:

an ActionQMenu

.newMenuOnly

Create an ActionMenu without the trigger button, so you can attach the menu to MainMenu

See code examples below.

Arguments:

name

The Menu Button Title

items

An Array of String, Association (\key->function), MenuAction, or ActionQSubMenu.

NOTE: items

A String is interpreted as file or folder paths (except if they start with "-");

A String ending in "/*" will iterated over the files in the directory on the top level.

If a String starts with "-", it creates a menu separator.

Use an Association to trigger the associated function (and globalAction).

Use a MenuAction to customize all aspects of the menu, and trigger the associated action (and globalAction).

Use a ActionQSubMenu to create a sub-menu.

WARNING: When registering with MainMenu, "-" cannot be repeated without adding a unique name (which is not rendered)
defaultAction

a default action, in case not action is specified.

globalAction

a global action which is run for any item.

lazyLoad

default: defaultLazyLoad. lazy load the submenus. False makes menu items more respnsive.

Caution: false can slow things down with large directories and subdirectories.

Returns:

an ActionQMenu without a trigger button

.defaultAllowedFiles

Default: ["rtf","rtfd","sc","scd","html","HTML","schelp"]

.defaultOpenAction

a default function you can set for all items.

{|path,action,what,val| doSomething()}

.defaultLazyLoad

default: true. Preload the submenus. Makes menu items more respnsive. Caution: can slow things down with large directories.

Inherited class methods

Instance Methods

.allowedFiles

Default: ["rtf","rtfd","sc","scd","html","HTML","schelp"]

.openAction

a function run on the selected path. Typically open a file.

{|path,action,what,val| doSomething()}

for action,what,val, see Menu

You can set it on the instance, or you can set a default with PathActionMenu.defaultOpenAction

Inherited instance methods

Examples

NOTE: items

A String is interpreted as file or folder paths (except if they start with "-");

A String ending in "/*" will iterated over the files in the directory on the top level.

If a String starts with "-", it creates a menu separator.

Use an Association to trigger the associated function (and globalAction).

Use a MenuAction to customize all aspects of the menu, and trigger the associated action (and globalAction).

Use a ActionQSubMenu to create a sub-menu.

Using with MainMenu

WARNING: When registering with MainMenu, "-" cannot be repeated without adding a unique name (which is not rendered)