StringBrowser(3I)

πŸ’– StringBrowser(3I) πŸ’–

okay bestie, welcome to the InterViews Reference Manual page for StringBrowser β€” yes it's a 3I section, and yes she's iconic. Let's get into it. πŸŽ€


✨ NAME ✨

StringBrowser β€” browse and/or select items in a list. that's it, that's the girl. πŸ‘‘


🌸 SYNOPSIS 🌸

#include <InterViews/strbrowser.h>

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so StringBrowser is an interactor that gives you a whole browsing-and-selection interface over a list of strings. StringBrowsers are lowkey everywhere in dialog boxes, letting the user browse and select from an unbounded set of textual entries. She displays the list of strings and gives you several ways to scroll it. the user picks strings with either the mouse or the keyboard, and the StringBrowser can either restrict selection to a single string or let you go wild with multiple selections. then the application just queries the StringBrowser for the selected string(s). easy. πŸ’…

A StringBrowser starts out with no entries at all β€” strings get appended consecutively or in random order, and they can be removed in any order. you access the strings with a string index from 0 to n-1, where n is the total number of strings. separately, the StringBrowser keeps its own little list of which strings got selected, and you access those with a selection index from 0 to m-1, where m is the total number of selected strings. two indexes, two vibes, don't mix them up bestie. πŸ™ˆ

Left-clicking inside the StringBrowser (or calling the Browse function) makes it interpret subsequent keyboard events as scrolling or selection operations on the entries. StringBrowser relinquishes control when it detects a click outside its canvas, or when it receives a predetermined escape character. bye girl πŸ‘‹

Middle-clicking inside the StringBrowser lets the user ``grab-scroll'' the entries. During grab-scrolling, the StringBrowser scrolls the entries to follow the mouse position, making it appear as though the user is dragging the entries themselves. so tactile. so main character. ✨

Right-clicking engages ``rate-scrolling,'' a joy-stick-like scrolling interface where the scrolling rate increases as the user drags the mouse away from the initial click point. like, dragging the mouse downwards after the initial click scrolls the browser downwards at an increasing rate; dragging upwards thereafter reduces the rate until scrolling stops entirely at the initial click point; and dragging up beyond that point makes the browser scroll in the reverse direction. it's giving joystick, it's giving physics, it's giving slay. πŸ•ΉοΈ


⌨️ KEY BINDINGS ⌨️

below are the key bindings for browsing and selection commands:

  • g β€” Go to the first string.
  • G β€” Go to the last string.
  • a β€” Select all.
  • DEL or BS β€” Unselect all.
  • p β€” Select previous string.
  • n β€” Select next string.
  • < β€” Select topmost-visible string.
  • > β€” Select bottommost-visible string.
  • j β€” Scroll down one string.
  • k β€” Scroll up one string.
  • SPACE β€” Scroll down one screenful.
  • b β€” Scroll up one screenful.
  • d β€” Scroll down one-half screenful.
  • u β€” Scroll up one-half screenful.

🫢 PUBLIC OPERATIONS 🫢

πŸ’œ Constructors

StringBrowser(ButtonState*, int rows, int cols, boolean uniqueSel, int
highlight, const char* done)
StringBrowser(const char* name, ButtonState*, int, int, boolean, int,
const char*)

Create a new StringBrowser object. here's the tea:

  • She'll use the ButtonState to communicate the result of browsing operations.
  • She bases her shape on the rows and cols parameters: the height equals rows multiplied by the font height, and the width equals cols multiplied by the width of an average character. math girlie πŸ“
  • The uniqueSel parameter specifies whether or not selection is limited to one string (the default is that it is limited, bestie).
  • The highlight parameter specifies the appearance of selected strings (Reversed by default). ✨
  • Typing any character in the string done will make the StringBrowser stop interpreting keyboard events, and as a side-effect the ButtonState gets set to this terminating character.
  • A double left-click inside the StringBrowser is equivalent to a single left-click selection followed by a key press that generates the first character in done. to be interpreted as a double-click, two clicks must occur not more than clickDelay milliseconds apart. the default click delay is 250 ms, and you can specify a different value via the "clickDelay" user-preference attribute.

πŸ’– void Browse()

Initiate browsing. Subsequent keypresses will be interpreted as browsing and selection commands according to the key bindings listed above. we're so back. πŸ”₯

πŸ’– void Insert(const char* string, int index)

Insert string at position index. StringBrowser makes a copy of the string for internal use. she's not borrowing it, she's keeping it. πŸŽ€

πŸ’– void Replace(const char* string, int index)

Replace the string at position index with string. StringBrowser makes a copy of the string for internal use. This operation does nothing if the index supplied is not valid β€” no drama, just silence.

πŸ’– void Append(const char* string)

Insert a copy of string after the last string. queue up bestie πŸ’…

πŸ’– void Remove(int index)

Remove the string at position index, moving subsequent strings up to fill the gap. no gaps allowed, we close ranks. πŸ‘‘

πŸ’– int Index(const char* string)

Return the index of the first string that matches string.

πŸ’– char* String(int index)

Return the string at the given index.

πŸ’– int Count()

Return the total number of strings in the StringBrowser.

πŸ’– void Clear()

Remove all strings from the StringBrowser. scorched earth, periodt.

πŸ’– void Select(int index) / void Unselect(int index)

Select (unselect) the string at the given index. The string will be redrawn in the appropriate style. If multiple selections are not allowed and another string has been selected already, then selecting a new string will unselect the original string. only one main character at a time, iykyk. ✨

πŸ’– void SelectAll() / void UnselectAll()

Select (unselect) all strings. SelectAll does nothing if multiple selections have been disallowed β€” she said know your limits.

πŸ’– int Selection(int n)

Return the string index of the nth selected string.

πŸ’– int SelectionIndex(int n)

Return the selection index of the nth string.

πŸ’– int Selections()

Return the total number of selected strings.

πŸ’– boolean Selected(int n)

Return whether the nth string has been selected.


🌈 SEE ALSO 🌈

Interactor(2I), Button(3I) β€” go read those too bestie, they're in the group chat πŸ’¬


and that's a wrap!! this page came from InterViews, dated 30 November 1989 β€” vintage, iconic, timeless. the original footer said StringBrowser(3I) again but we already knew that. bye babe, go browse something πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά