eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'MenuItem':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: MenuItem


Inheritance:

   Object
   |
   +--MenuItem

Package:
stx:libview2
Category:
Views-Support
Version:
rev: 1.137 date: 2019/08/10 11:39:30
user: cg
file: MenuItem.st directory: libview2
module: stx stc-classLibrary: libview2
Author:
Claus Gittinger

Description:


This together with MenuPanel will eventually replace
most of the MenuView and PopUpMenu stuff.
(and hopefully be ST-80 compatible ...)

For now, only a subset of the full protocol is implemented.

new:
    %(xx) in label text will be expanded by asking the application
    for the xx labelFor:-aspect.


[instance variables:]
    label: MUST be a CharacterArray.


Related information:

    MenuItem
    PopUpMenu

Class protocol:

class initialization
o  initialize
(comment from inherited method)
called only once - initialize signals

constants
o  supportedStartGroupValues
start group #left #right #conditionalRight ...
At the moment only #left/nil, #right/#conditionalRight are implemented.

The meanings are:
nil - default under control of the menu
#left - left align
#right - place at the right far end
#conditionalRight - controlled by a styleSheet variable;
like #right under all non-win32 systems,
ignored on win32.
Use with help-menu, which should be at the far right on some
viewStyles, but not under win32.

instance creation
o  label: aString
create and return a new menuItem, given a label string

o  label: labelString argument: messageArg
create and return a new menuItem, given its label and value
and an argument to be passed with the action

o  label: labelString choice: choiceAspect choiceValue: selectorOrValue
create and return a new menuItem, given its label and choice/value.
This will create a Radio-Button-like item.

o  label: labelString itemValue: selectorOrValue
create and return a new menuItem, given its label and value

o  label: labelString itemValue: selectorOrValue argument: messageArg
create and return a new menuItem, given its label and value
and an argument to be passed with the action

o  label: labelString itemValue: selectorOrValue enabled: enabledHolder
create and return a new menuItem, given its label, value
and enabled holder, which can be a boolean, a boolean valueHolder,
a block or a selector (to be sent to the application)

o  label: labelString itemValue: selectorOrValue translateLabel: translateLabel
create and return a new menuItem, given its label, value and translateLabel flag

o  label: labelString submenuChannel: aSymbolOrValueHolder
create and return a new menuItem, given its label and value

o  label: labelString value: selectorOrValue
create and return a new menuItem, given its label and value

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  label: labelString value: selectorOrValue argument: messageArg
create and return a new menuItem, given its label and value

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  label: labelString value: selectorOrValue enabled: enabledHolder
create and return a new menuItem, given its label and value

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  labeled: aString
create and return a new menuItem, given a label string

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  separator
create and return a new menuItem for a '----' separator

o  separator2
create and return a new menuItem for a '====' separator

o  separator: sepString
create and return a new menuItem for a separator


Instance protocol:

Compatibility-ST80
o  enablementSelector: aSymbol
dummy for now - for visualworks compatibility (specs)

o  helpText: aString
dummy for now - for visualworks compatibility (specs)

o  indicationSelector: aSymbol
dummy for now - for visualworks compatibility (specs)

o  isEnabled: aBoolean

o  shortcutModifiers: something
dummy for now - for visualworks compatibility (specs)

o  value
obsolete - please use #itemValue (value is bad: it prevents us from using a valueHolder)

o  value: something
obsolete - please use #itemValue: (value is bad: it prevents us from using a valueHolder)

accessing
o  accessCharacterPosition
get the index of the access character in the label text or string, or nil if none

o  accessCharacterPosition: index
set the index of the access character in the label text or string, or nil if none

o  activeHelpKey
the key used as index (and argument) to the helpSpec.
New: may also be an association; then the assoc's key is the help-text provider,
and the assoc's value is the key in that provider's helpspec.

o  activeHelpKey: aSymbolicKeyOrClassPlusSymbolAssoc
the key used as index (and argument) to the helpSpec.
New: may also be an association; then the assoc's key is the help-text provider,
and the assoc's value is the key in that provider's helpspec.

o  argument
get argument given to the value (selector)

o  argument: something
set argument given to the value (selector)

o  auxValue
an additional, arbitrary value

o  auxValue: something
set the auxValue - an arbitrary user value

o  choice: something

o  choiceValue

o  choiceValue: something

o  hierarchicalUUID

o  ignoreMnemonicKeys
if true, mnemonic (access character) in the submenus under the item are ignored;
Set this to speedup accelerator key processing for slow dynamci menus.
The default is set to false

usage example(s):

ignoreMnemonicKeys ? false

o  ignoreMnemonicKeys: aBoolean
if true, mnemonic (access character) in the submenus under the item are ignored;
Set this to speedup accelerator key processing for slow dynamci menus.
The default is false

o  ignoreShortcutKeys
if true, shortcutKeys (accelerators) in the submenus under the item are ignored;
the default is set to false

usage example(s):

ignoreShortcutKeys ? false

o  ignoreShortcutKeys: aBoolean
if true, shortcutKeys (accelerators) in the submenus under the item are ignored;
the default is set to false

o  indication
value of the items on/off indicator (CheckToggle).
Usually a valueHolder

o  indication: someValueHolder
value of the items on/off indicator (CheckToggle).
someValueHolder is usually a value holder

o  isVisible
a visibility holder; either a block, boolean or value holder.
If the menu is permanently visible, it should be a valueHolder,
as the value is otherwise only checked for before the menu is opened

o  isVisible: something
a visibility holder; either a block, boolean or value holder.
If the menu is permanently visible, it should be a valueHolder,
as the value is otherwise only checked for before the menu is opened

o  itemValue
the item's action; if it is a block, that is evaluated;
if a symbol, that message is sent to the menu's receiver

o  itemValue: aBlockOrSymbol
set the item's action; if it is a block, that is evaluated;
if a symbol, that message is sent to the menu's receiver

o  itemValue: selectorOrBlock argument: anArgument
set the item's action and an argument; if it is ablock, that is evaluated;
if a symbol, that message is sent to the menu's receiver

o  label: labelStringOrNil argument: someArgument

o  label: labelStringOrNil icon: anImage
Modified (format): / 27-12-2018 / 16:22:54 / Claus Gittinger

o  label: labelStringOrNil itemValue: selectorOrBlock

o  label: labelStringOrNil itemValue: selectorOrBlock argument: something
define label, value and an argument to be passed with the action

o  label: labelStringOrNil itemValue: selectorOrBlock enabled: enabledHolder
define label, value
and enabled holder, which can be a boolean, a boolean valueHolder,
a block or a selector (to be sent to the application)

o  label: labelStringOrNil itemValue: selectorOrBlock translateLabel: translateLabelBoolean

o  labelImage

o  labelImage: something
VW compatibility: if I have a label also,

o  nameKey

o  nameKey: aNameKey

o  rawLabel

o  rawLabel: aString

o  resourceRetriever

o  resourceRetriever: aRetriever

o  shortcutKey
get the key to press to select the menu item from the keyboard

o  shortcutKey: something
set the key to press to select the menu item from the keyboard

o  shortcutKeyCharacter
Backward compatibility; same as #shortcutKey.
get the key to press to select the menu item from the keyboard

o  shortcutKeyCharacter: something
Backward compatibility; same as #shortcutKey:.
set the key to press to select the menu item from the keyboard

o  submenu
get the submenu or nil

o  submenu: aMenu
set the submenu or nil

o  submenuProvider
useful if a sub-menu is plugged in from another application (i.e. when
a submenu is fetched via a channel AND the top-menus application cannot provide
it

o  submenuProvider: something
useful if a sub-menu is plugged in from another application (i.e. when
a submenu is fetched via a channel AND the top-menus application cannot provide
it

o  uuid
automationID
return my uuid component to be used for resource-access.
This is a unique and once-assigned-never-changed uuid by which
UI automators can access the menu item.

o  uuid: aUUID
automationID
set my uuid component to be used for resource-access
(called by menuBuilder).
This is a unique and once-assigned-never-changed uuid by which
UI automators can access the menu item.

accessing-behavior
o  beOff
set indication off

o  beOn
set indication on

o  choice
return the menu items choice indicator (RadioButton)

o  disable

o  enable

o  enabled
returns a boolean, valueHolder or block

o  enabled: enabledHolder
enabledHolder can be a boolean, a boolean valueHolder,
a block or a selector (to be sent to the application)

o  hideMenuOnActivated
hide the menu when the item was activated; the default is true

usage example(s):

hideMenuOnActivated ? true

o  hideMenuOnActivated: aBoolean
hide the menu when the item was activated; the default is true

o  keepLinkedMenu
if true, a linked submenu menu is only computed once (slightly faster),
but then, the linked menu cannot be dynamic

usage example(s):

keepLinkedMenu ? false

o  keepLinkedMenu: aBoolean
if true, a linked submenu menu is only computed once (slightly faster),
but then, the linked menu cannot be dynamic

o  sendToOriginator
if true, the message is sent to the originating widget;
otherwise (the default), it it sent to the receiver/application.

usage example(s):

sendToOriginator ? false

o  sendToOriginator: aBoolean
if true, the message is sent to the originating widget;
otherwise (the default), it it sent to the receiver/application.

o  showBusyCursorWhilePerforming
get the flag which controls if a busy cursor is to be shown
while performing the menu action. Defaults to false.

usage example(s):

showBusyCursorWhilePerforming ? false

o  showBusyCursorWhilePerforming: aBoolean
set/clear the flag which controls if a busy cursor is to be shown
while performing the menu action. Defaults to false.

o  translateLabel
returns true if the label is to be translated.
The default is true

usage example(s):

translateLabel ? true

o  translateLabel: aBoolean
sets whether label is translated

o  triggerOnDown
returns true if the action is triggered when pressed.
The default is false (trigger when released)

usage example(s):

triggerOnDown ? false

o  triggerOnDown: aBoolean
controls if the action is triggered when pressed or released

accessing-channels
o  label: labelString submenuChannel: aSymbolOrValueHolder

o  submenuChannel
get the submenuChannel or nil.
That is a submenu-value provider

o  submenuChannel: aMenuHolder
set the submenuChannel or nil.
That is a submenu-value provider

accessing-look
o  font
get the specific font for an item or nil

o  font: aFont
set a specific font for an item

o  hasMenuIndicator
returns whether item should always show a menu-indicator (arrow)

o  hasMenuIndicator: aBoolean
force the item to always show a menu-indicator (arrow)

o  horizontalLayout
by default, submenus have a vertical layout;
if true, the submenu has a horizontal layout.

usage example(s):

horizontalLayout ? false

o  horizontalLayout: aBoolean
by default, submenus have a vertical layout;
if true, the submenu has a horizontal layout.

o  icon: anImage

o  isButton
returns whether item looks like a Button

usage example(s):

isButton ? false

o  isButton: aBoolean
sets whether item looks like a Button

o  isMenuSlice
returns true if the menu is a slice,
building its items into its container menu

usage example(s):

isMenuSlice == true

o  isMenuSlice: aBoolean
isMenuSlice := aBoolean.

o  label
label

o  label: aString

o  startGroup
start group #left #right #conditionalRight ... or nil
at the moment only #right and #conditionalRight are implemented

o  startGroup: aSymbol
start group #left #right #conditionalRight ...
at the moment only #right and #conditionalRight are implemented.
The meanings are:
nil - default under control of the menu
#left - left align
#right - place at the right far end
#conditionalRight - controlled by a styleSheet variable;
like #right under all non-win32 systems,
ignored on win32.
Use with help-menu, which should be at the far right on some
viewStyles, but not under win32.

accessing-resource
o  findGuiResourcesIn: aResourceContainerOrApplication
resolve national language translations from aResourceContainerOrApplication

o  findGuiResourcesIn: aResourceContainerOrApplication rememberResourcesIn: aValueHolderOrNil
resolve national language translations from aResourceContainerOrApplication.
In addition, expand %(xxx) by asking the application for an xxx aspect.

o  receiver: aReceiver perform: aSelector with: anArgument ifNone: aBlock
send the one-arg-message aSelector to the application;
the result returned from the send or nil is returned

o  resolveSliceMenuItemsIn: aReceiver for: originalReceiver rememberResourcesIn: aValueHolderOrNil
('MenuItem [info]: no aspect for slice ',submenuChannel) infoPrintCR.

o  resolveSliceMenuItemsIn: aReceiver rememberResourcesIn: aValueHolderOrNil

encoding & decoding
o  fromLiteralArrayEncoding: aLiteralEncodedArray
read my contents from a aLiteralEncodedArray

o  skippedInLiteralEncoding
define the inst-slots which are skipped when generating a literalArrayEncoding;
(to skip the ones with default values.)

o  virtualSlotsInLiteralEncoding
defines additional virtual slots in the literalEncoding.
These are not instvars, but accessed via getters and setters during
store and load.
Use this when flags encode values which were previously encoded as boolean instvars,
to remain backward compatible

printing & storing
o  printOn: aStream

private-accessing
o  filteredLabel
return the label without any &-chars

queries
o  hasChoice
test whether choice exists

o  hasIndication
test whether indication on/off exists

o  hasSubmenu

o  isEnabled

o  isHidden
not yet supported

o  isMenuItem

o  isOff
test whether indication on/off exists and is off

o  isOn
test whether indication on/off exists and is on

o  isSeparatorItem

utilities
o  replaceArgument: oldValue with: newValue
Recusively Replace argument in menu items where
current argument is equal to oldValue by newValue



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Sat, 20 Apr 2024 05:33:29 GMT