Next Previous Up Top Contents Index

5.3 DUIM-Sheets Module

choose-from-menu

Generic function

Summary

Prompt the user to choose from a collection of items, using a pop-up menu.

Signature

choose-from-menu items 
#key frame owner title value default-item label-key value-key
width height foreground background text-style multiple-sets?
=> value success?

Arguments

items
An instance of type-union(<sequence>, <menu>).

frame
An instance of type <frame>. Default value: #f.

owner
An instance of type <sheet>. Default value: #f.

title
An instance of type <string>. Default value: #f.

default-item
An instance of type <object>.

label-key
An instance of type <function>. Default value: identity.

value-key
An instance of type <function>. Default value: identity.

foreground
An instance of type <ink>.

background
An instance of type <ink>.

text-style
An instance of type <text-style>.

Values

value
An instance of type <object>.

success?
An instance of type <boolean>.

Library

duim-sheets

Module

duim-sheets

Description

Prompt the user to choose from a collection of items, using a pop-up menu.This generic function is similar to choose-from-dialog.

The function returns the value chosen by the user, and a boolean value: #t if a value was chosen, #f if nothing was chosen.

At its most basic, choose-from-menu can be passed a simple sequence of items, as follows:

  choose-from-menu(#(1, 2, 3));

However, any of a large number of keywords can be supplied to specify more clearly the menu that is created. A range of typical options can be chosen: The frame keyword specifies a frame whose top level sheet becomes the owner of the menu. Alternatively, you can specify this top level sheet explicitly using owner. The title keyword lets you choose a title for the dialog. By default, each of these values is #f.

In addition, choose-from-menu offers options similar to collection gadgets, that can act upon the items specified. The default-item keyword lets you specify an item that is returned by default if no value is chosen explicitly (thereby ensuring that success? will always be #t). You can also specify a value-key or label-key for the items in the menu.

Finally, you can configure the appearance of the menu itself. The width and height keywords let you set the size of the menu. The foreground and background keywords let you set the text color and the menu color respectively. The text-style keyword lets you specify a font to display the menu items.

See also

choose-from-dialog, page 228


Functional Developer Library Reference: DUIM - 3 Dec 1998

Next Previous Up Top Contents Index