You are here: Recent News » Projects » ActionStep » ActionStep FAQs » Menu FAQ

 

Menu FAQ

This page attempts to answer some of the common questions regarding the menu family, namely:

  1. org.actionstep.NSMenu
  2. org.actionstep.NSMenuItem
  3. org.actionstep.menu.NSMenuView
  4. org.actionstep.menu.NSMenuItemCell
  5. org.actionstep.menu.NSMenuPanel

They are not listed in order of significance.

Why does NSMenuItem.setMenu clear the key equivalent? I thought -setKeyEquivalent would not even let it contain any value in the first place.

When the instance is created and initialized, the ‘m_menu’ property is not yet set. Thus, the ‘if’ check in -setKeyEquivalent will not throw an exception.

public function setKeyEquivalent(aKeyEquivalent:String):Void {
	if(m_menu.isRoot()) {
		trace(g_rootHasNoKeyEquivalent);
		throw g_rootHasNoKeyEquivalent;
	}
		//...
}

Why does a NSMenuView and NSMenuItemCell still exist? I thought the Apple spec has specified that they have been deprecated.

The current Mac OS has moved menu support to Carbon, thus they are no longer used. However, in Flash, there is no such equivalent. As a result, ActionStep still provides this deprecated functionality.

Why doesn't the methods for getting key equivalent offset and width exist in NSMenuView, but are present in NSMenuItemCell?

Note that the title and key equivalent are displayed together in the same text field. These methods are present in NSMenuItemCell, so that NSMenuView can calculate the largest title and key equivalent width for display.

However, NSMenuItemCell doesn’t need this information, so its rather irrelevent and has been removed as a result.

Why doesn't the methods for image and title offset and width exist in NSMenuView exist at all?

Images and titles are displayed separately, and this constant doesn’t make any sense. Hence their non-existence.

What can a menu with a submenu not do?

It cannot display or perform key equivalents.

What can the root menu not do?

It cannot :

  1. display or perform key equivalents,
  2. display state eg. NSCell.NSOnState

What occurs if there is insufficient viewable space to attach a menu?

The following behaviour occurs only when attaching a vertical submenu to another vertical submenu.

The menu checks against the property menu.NSMenuView.bounds():NSSize

The submenu is usually attached to the right of the ancestor menu, but if there is not enough space on the right, it will be attached on the left instead.

The submenu is usually attached such that its y-origin (Flash co-ordinates) will be higher than the ancestor menu, but if there is not enough space vertically, it will be stacked on the bottom of the screen.

The above behaviour is incorrect as it does not take into account the menu’s height, since the top-most items would be obscured from view.

The correct way would be to force a scrollable menu, which has yet to be implemented.

projects/actionstep/faqs/menu.txt · Last modified: 2006/02/01 04:31