► |  | Mr Lib: Extra GUI Libraries

1 | Aligned Pasteboard
2 | Arrow Toggle Snip
3 | Bitmap Label
4 | Cache-image Snip
5 | Close Icon
6 | Expandable Snip
7 | GIF and Animated GIF Writing
8 | Graphs
9 | Hierarchical List Control
10 | Include Bitmap
11 | Interactive Value Port
12 | Name Message
13 | Path Dialog
14 | Plot
15 | Switchable Button
16 | Image Core
17 | Matrix Snip
18 | Snip Canvases
19 | Syntax Browser
20 | Te X Table
21 | Terminal Window
22 | White on Black Panel Predicate
23 | Acknowledgments
| Index

▼ | 9 | Hierarchical List Control

9.1 | hierarchical-list%
9.2 | hierarchical-list-item<%>
9.3 | hierarchical-list-compound-item<%>
9.4 | Snips in a hierarchical-list% Instance

On this page:

new
get-selected
new-item
set-no-sublists
new-list
delete-item
get-items
selectable
on-select
on-click
on-double-select
on-item-opened
on-item-closed
sort
can-do-edit-operation?
do-edit-operation
select-prev
select-next
select-first
select-last
select-in
select-out
page-up
page-down
select
click-select
on-select-always
on-click-always
allow-deselect

Inherited methods:
from editor-canvas%
allow-scroll-to-last
allow-tab-exit
call-as-primary-owner
force-display-focus
get-editor
get-line-count
get-scroll-via-copy
horizontal-inset
lazy-refresh
on-char
on-event
on-focus
on-paint
on-size
scroll-to
scroll-with-bottom-base
set-editor
set-line-count
set-scroll-via-copy
vertical-inset
wheel-step
from canvas<%>
accept-tab-focus
flush
get-canvas-background
get-dc
get-scaled-client-size
min-client-height
min-client-width
on-tab-in
resume-flush
set-canvas-background
set-resize-corner
suspend-flush
from subwindow<%>
reparent
from window<%>
accept-drop-files
client->screen
enable
focus
get-client-handle
get-client-size
get-cursor
get-handle
get-height
get-label
get-plain-label
get-size
get-width
get-x
get-y
has-focus?
is-enabled?
is-shown?
on-drop-file
on-move
on-subwindow-char
on-subwindow-event
on-subwindow-focus
on-superwindow-activate
on-superwindow-enable
on-superwindow-show
popup-menu
refresh
screen->client
set-cursor
set-label
show
warp-pointer
wheel-event-mode
from area<%>
get-graphical-min-size
get-parent
get-top-level-window
min-height
min-width
stretchable-height
stretchable-width
from subarea<%>
horiz-margin
vert-margin

top ← prev up next →

> class

> hierarchical-list% : class?

superclass: editor-canvas%

Creates a hierarchical-list control.

> > constructor

> > (new hierarchical-list% |
> > |  | [parent parent] |
> > | [ | [style style]]) |

> → (is-a?/c hierarchical-list%)

> parent

> :

> (or/c (is-a?/c frame%) (is-a?/c dialog%)
> (is-a?/c panel%) (is-a?/c pane%))

> style

> :

> (listof (one-of/c 'no-border 'control-border 'combo
> 'no-hscroll 'no-vscroll
> 'hide-hscroll 'hide-vscroll
> 'auto-vscroll 'auto-hscroll
> 'resize-corner 'deleted 'transparent))

> |  |  | = |  | '(no-hscroll)

Creates the control.

If the style 'transparent is passed, then the use-style-background method will be called with #t when editor snips are created as part of the hierarchical list, ensuring that the entire control is transparent.

> > method

> > (send a-hierarchical-list get-selected)

> →

> (or/c (is-a?/c hierarchical-list-item<%>)
> false/c)

Returns the currently selected item, if any.

> > method

> > (send a-hierarchical-list new-item [mixin])

> → (is-a?/c hierarchical-list-item<%>)

> mixin

> :

> ((implementation?/c hierarchical-list-item<%>)
> . -> .
> (implementation?/c hierarchical-list-item<%>))

> |  |  | = |  | (lambda (%) %)

Creates and returns a new (empty) item in the list. See hierarchical-list-item<%> for methods to fill in the item’s label.

The mixin argument is applied to a class implementing hierarchical-list-item<%>, and the resulting class is instantiated as the list item.

> > method

> > (send a-hierarchical-list set-no-sublists no-sublists?) → void?

> no-sublists? : any/c

Enables/disables sublist mode. When sublists are disabled, space to the left of the list items (that would normally align non-list items with list items) is omitted. This method can be called only when the list is empty.

> > method

> > (send a-hierarchical-list new-list [mixin])

> → (is-a?/c hierarchical-list-compound-item<%>)

> mixin

> :

> ((implementation?/c hierarchical-list-compound-item<%>)
> . -> .
> (implementation?/c hierarchical-list-compound-item<%>))

> |  |  | = |  | (lambda (%) %)

Creates and returns a new (empty) sub-list in the list. See hierarchical-list-compound-item<%> for methods to fill in the item’s label and content.

The mixin argument is applied to a class implementing hierarchical-list-compound-item<%>, and the resulting class is instantiated as the sub-list.

> > method

> > (send a-hierarchical-list delete-item i) → void?

> i : (is-a?/c hierarchical-list-item<%>)

Deletes immediate item or sub-list i from the list.

> > method

> > (send a-hierarchical-list get-items)

> → (listof (is-a?/c hierarchical-list-item<%>))

Returns a list of all immediate items in the list control.

> > method

> > (send a-hierarchical-list selectable) → boolean?

> (send a-hierarchical-list selectable on?) → void?
> on? : any/c

Reports whether items are selectable, or enables/disables item selection.

> > method

> > (send a-hierarchical-list on-select i) → any

> i : (or/c (is-a?/c hierarchical-list-item<%>) false/c)

Called for new select of i, where i is #f if no item is now selected.

> > method

> > (send a-hierarchical-list on-click i) → any

> i : (is-a?/c hierarchical-list-item<%>)

Called when an item is clicked on, but selection for that item is not allowed. Selection can be disallowed by selectable or set-allow-selection in hierarchical-list-item<%>.

> > method

> > (send a-hierarchical-list on-double-select i) → any

> i : (is-a?/c hierarchical-list-item<%>)

Called for a double-click on i.

> > method

> > (send a-hierarchical-list on-item-opened i) → any

> i : (is-a?/c hierarchical-list-compound-item<%>)

Called when the arrow for i is turned down.

> > method

> > (send a-hierarchical-list on-item-closed i) → any

> i : (is-a?/c hierarchical-list-compound-item<%>)

Called when the arrow for i is turned up.

> > method

> > (send a-hierarchical-list sort |  | less-than-proc |  |  |  |
> > | [ | recur?]) |  | → |  | void?

> less-than-proc

> :

> ((is-a?/c hierarchical-list-item<%>)
> (is-a?/c hierarchical-list-item<%>)
> . -> . any/c)

> recur? : any/c = #t

Sorts items in the list by calling less-than-proc on pairs of items. If recur? is true, items in sub-lists are sorted recursively.

> > method

> > (send a-hierarchical-list can-do-edit-operation? |  | op |
> > | [ | recursive?]) |

> → boolean?
> op : symbol?
> recursive? : any/c = #t

Like can-do-edit-operation? in editor<%>. The default implementation always returns #f.

> > method

> > (send a-hierarchical-list do-edit-operation |  | op |  |  |  |
> > | [ | recursive?]) |  | → |  | void?

> op : symbol?
> recursive? : any/c = #t

Like do-edit-operation in editor<%>. The default implementation does nothing.

> > method

> > (send a-hierarchical-list select-prev) → void?

> (send a-hierarchical-list select-next) → void?
> (send a-hierarchical-list select-first) → void?
> (send a-hierarchical-list select-last) → void?
> (send a-hierarchical-list select-in) → void?
> (send a-hierarchical-list select-out) → void?
> (send a-hierarchical-list page-up) → void?
> (send a-hierarchical-list page-down) → void?

Move the selection, scroll, and call on-select.

> > method

> > (send a-hierarchical-list select i) → void?

> i : (or/c (is-a?/c hierarchical-list-item<%>) false/c)

Moves the selection, scrolls as necessary to show it, and calls on-select unless disabled via on-select-always.

The allow-deselect method controls whether i is allowed to be #f to deselect the currently selected item.

> > method

> > (send a-hierarchical-list click-select i) → void?

> i : (or/c (is-a?/c hierarchical-list-item<%>) false/c)

Like select, but always calls on-select.

> > method

> > (send a-hierarchical-list on-select-always) → boolean?

> (send a-hierarchical-list on-select-always always?) → void?
> always? : any/c

Gets/sets whether the on-select method is called in response to select (as opposed to click-select).

The initial mode enables on-select calls always.

> > method

> > (send a-hierarchical-list on-click-always) → boolean?

> (send a-hierarchical-list on-click-always always?) → void?
> always? : any/c

Gets/sets whether the on-click method is called in response to all mouse clicks (as opposed to only when selected). on-click is called before on-select, if it is called (if the click results in selction).

This is initially disabled, by default.

> > method

> > (send a-hierarchical-list allow-deselect) → boolean?

> (send a-hierarchical-list allow-deselect allow?) → void?
> allow? : any/c

Gets/sets whether the on-select can be called with a #f argument to deselect the current item (leaving none selected).

The initial mode does not allow deselection.
top ← prev up next →