<--- Cannot embed stylesheet: [Errno 2] No such file or directory: '../../../../aros.css' --->

Cycle.mui

MUIA_Cycle_Active

Function

Select an entry or return the stored zero-based index.

Inputs

Initialize, set and get, LONG. Default zero. At construction, an index
outside the created page range becomes zero. For Set only,
MUIV_Cycle_Active_Next (-1) and MUIV_Cycle_Active_Prev (-2) advance or
reverse with wrapping.

Notes

Set changes the page only for a valid index different from the stored
value. An unchanged or invalid request is rewritten to TAG_IGNORE in the
caller's tag list, suppressing that tag's notification. Supply writable
tags and rebuild ignored tags before reusing a list. The special values
are resolved only for selection: ti_Data is not replaced with the
resulting index. A notification using MUIV_TriggerValue therefore
receives the original Next/Prev token; read Active to obtain the
resulting index.
When the list contains only Cycle Entries/Active tags, the superclass
call prepends Group_Forward FALSE, preventing child forwarding without
suppressing notifications. Mixed tag lists use normal Group forwarding.
Get returns TRUE and stores the current index, including zero for an
empty entry list. Setter return values come from Group and do not
certify a selection change.

MUIA_Cycle_Entries

Function

Replace the available entries and rebuild the text pages.

Inputs

Initialize and set; pointer to a NULL-terminated array of pointers to
terminated strings. No local getter. Omitted at construction: one empty
entry. NULL or an array whose first element is NULL creates no pages.

Notes

The array and strings are borrowed and must remain readable and
unchanged until replacement or disposal. Text children copy their
labels, but popup text is later built from the original strings. Do not
free or edit the input after construction merely because the closed
gadget displays copied text.
Set closes the popup, disposes old pages, builds new pages within Group
InitChange/ExitChange, then resets Active to zero. This reset does not
generate a separate Cycle_Active tag notification. Multiple Entries and
Active tags take effect in tag order. Use a nonempty array when a
meaningful selected entry is required: with no pages, Get Active still
returns zero.
Page allocation failure stops construction at the successfully created
prefix; no aggregate failure is returned and old pages are not restored.
Member-add results are ignored. The build counter is UWORD, so the
terminating NULL must be reached before it wraps. Keep the much smaller
popup geometry limits in mind as well.

MUIC_Cycle

Superclass

Group.mui

Description

Select one entry using a cycling button and, when preferences permit, a
popup menu. The class creates an image and a PageGroup of Text children.
Children belong to the group; the entry array and its strings remain
borrowed because popup rendering reads them again. Omitted Entries
selects a static array containing one empty string. Initial Active
defaults to zero.
Use the normal Setup, Show, Hide and Cleanup lifecycle. Setup registers
a window event handler after successful superclass setup. Hide closes an
open popup; Cleanup removes the handler and delegates. There is no local
Dispose override and Cleanup does not independently close the popup.
Keep the object, parent window and entry storage alive during
synchronous event and notification processing.

Methods

Releasing the button advances the selection and wraps to zero. The
cycle-menu minimum-entry preference controls whether a popup can open.
Keyboard Press opens it when eligible; otherwise, or if opening fails,
Press advances as Down does. Without a popup, Up and Down wrap;
Top/PageUp and Bottom/PageDown select the first and last entry. With a
popup, these keys change its provisional highlight; Press accepts a
highlight other than -1, and Window Close cancels.
A mouse press to the right of the cycle image opens an eligible popup
when drawing is permitted. Pointer motion changes its highlight.
SELECTUP or a subsequent SELECTDOWN accepts a highlight other than -1;
other closing mouse codes cancel. The popup is a nonactivating,
borderless Intuition window on the object's screen. Preferences control
its position and recessed entries; a menu larger than the screen is
refused, not scrolled.
With a nonzero ObjectID, Export writes the current selection as one LONG
to the supplied Dataspace. Import finds that ID and sets Active from its
first LONG. Both return zero and ignore storage/set failures. Import
does not validate record size; provide a matching LONG record and a live
Dataspace. With ObjectID zero, neither performs data access.

Bugs

Popup allocation failures are not fully rolled back. Failure to allocate
the last popup text can evade the count check because the index is
incremented before allocation. OpenWindow failure leaves popup
text/background resources allocated; Hide only calls popup cleanup when
a window exists, and a retry can overwrite retained resources. No
complete allocation-failure cleanup guarantee is provided.
The initial popup highlight is -1, not the current selection. Up tests
the highlight for nonzero and can decrement this sentinel to -2; this is
not a valid selection. The Active setter interprets -2 as Prev, so
accepting this invalid highlight can move the selection backward. Popup
geometry uses WORD fields without overflow checks; avoid entry counts
and text dimensions that overflow these calculations.