Squeak Class Documentation category index | class index  
 
PopUpMenu
  category: Tools-Menus
  superclass: Object
  subclasses: SelectionMenu

I represent a list of items. My instances are presented on the display screen in a rectangular area. The user points to an item, pressing a mouse button; the item is highlighted. When the button is released, the highlighted item indicates the selection.

instance methods
  accessing
  center
frameHeight
labelString
lineArray
nItems

  basic control sequence
  controlActivity
readKeyboard
startUp
startUpCenteredWithCaption:
startUpSegmented:withCaption:at:
startUpWithCaption:
startUpWithCaption:at:

  displaying
  displayAt:withCaption:during:

  marker adjustment
  manageMarker
markerOff
markerOn:
markerTop:
scrollIntoView:

  private
  computeForm
computeLabelParagraph
labels:font:lines:
menuForm
rescan

  selecting
  selection
setSelection:

class methods
  class initialization
  initialize
setMenuFontTo:

  dialogs
  confirm:
confirm:orCancel:
confirm:trueChoice:falseChoice:
inform:
notify:

  instance creation
  labelArray:
labelArray:lines:
labels:
labels:lines:
withCaption:chooseFrom:

instance methods
  accessing top  
 

center

Answer the point at the center of the receiver's rectangular area.


 

frameHeight

Designed to avoid the entire frame computation (includes MVC form),
since the menu may well end up being displayed in Morphic anyway.


 

labelString


 

lineArray


 

nItems


  basic control sequence top  
 

controlActivity

Do whatever a menu must do - now with keyboard support.


 

readKeyboard

Keyboard support for menus. ESC will abort the menu, Space or CR
will select an item. Cursor up and cursor down will change the
selection. Any other key will either select an item whose label starts
with that character or select the next matching label.
Answer true if the menu should be closed and false otherwise.


 

startUp

Display and make a selection from the receiver as long as the button
is pressed. Answer the current selection.


 

startUpCenteredWithCaption:

Differs from startUpWithCaption: by appearing with cursor in the menu,
and thus ready to act on mouseUp, without requiring user tweak to confirm


 

startUpSegmented:withCaption:at:

This menu is too big to fit comfortably on the screen.
Break it up into smaller chunks, and manage the relative indices.
Inspired by a special-case solution by Reinier van Loon.


 

startUpWithCaption:

Display the menu, slightly offset from the cursor,
so that a slight tweak is required to confirm any action.


 

startUpWithCaption:at:

Display the menu, with caption if supplied. Wait for the mouse button to go down,
then track the selection as long as the button is pressed. When the button is released,
answer the index of the current selection, or zero if the mouse is not released over
any menu item. Location specifies the desired topLeft of the menu body rectangle.


  displaying top  
 

displayAt:withCaption:during:

Display the receiver just to the right of aPoint while aBlock is evaluated. If the receiver is forced off screen, display it just to the right.


  marker adjustment top  
 

manageMarker

If the cursor is inside the receiver's frame, then highlight the marked
item. Otherwise no item is to be marked.


 

markerOff

No item is selected. Reverse the highlight if any item has been marked
as selected.


 

markerOn:

The item whose bounding area contains aPoint should be marked as
selected. Highlight its area and set the selection to its index.


 

markerTop:

Answer aPoint, gridded to lines in the receiver.


 

scrollIntoView:


  private top  
 

computeForm

Compute and answer a Form to be displayed for this menu.


 

computeLabelParagraph

Answer a Paragraph containing this menu's labels, one per line and centered.


 

labels:font:lines:


 

menuForm

Answer a Form to be displayed for this menu.


 

rescan

Cause my form to be recomputed after a font change.


  selecting top  
 

selection

Answer the current selection.


 

setSelection:


class methods
  class initialization top  
 

initialize

PopUpMenu initialize


 

setMenuFontTo:

Set the menu font as indicated


  dialogs top  
 

confirm:

Put up a yes/no menu with caption queryString. Answer true if the
response is yes, false if no. This is a modal question--the user must
respond yes or no.


 

confirm:orCancel:

Put up a yes/no/cancel menu with caption aString. Answer true if
the response is yes, false if no. If cancel is chosen, evaluate
cancelBlock. This is a modal question--the user must respond yes or no.


 

confirm:trueChoice:falseChoice:

Put up a yes/no menu with caption queryString. The actual wording
for the two choices will be as provided in the trueChoice and
falseChoice parameters. Answer true if the response is the true-choice,
false if it's the false-choice.
This is a modal question -- the user must respond one way or the other.


 

inform:

PopUpMenu inform: 'I like Squeak'


 

notify:

Deprecated. Use #inform: instead.


  instance creation top  
 

labelArray:

Answer an instance of me whose items are in labelArray.


 

labelArray:lines:

Answer an instance of me whose items are in labelArray, with lines
drawn after each item indexed by anArray. 2/1/96 sw


 

labels:

Answer an instance of me whose items are in aString.


 

labels:lines:

Answer an instance of me whose items are in aString, with lines drawn
after each item indexed by anArray.


 

withCaption:chooseFrom:

Simply put up a menu. Get the args in the right order with the caption first. labels may be either an array of items or a string with CRs in it. May use backslashes for returns.