logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

StringChooser - dialog box for choosing items in a list

Description

       StringChooser  is  a  dialog  that  manages  keyboard focus between a StringBrowser and a StringEditor to
       provide a convenient interface to selecting strings.  The user can select  strings  either  by  selecting
       them  in  the  StringBrowser  or  by  typing  them  in the StringEditor. Like Dialog, StringChooser is an
       abstract class; programmers must derive from StringChooser to add push buttons, etc. and to compose  them
       into custom arrangements.

       The  user can focus keyboard input towards either the StringEditor or the StringBrowser.  To set focus to
       the StringEditor, for example, the user left-clicks  in  its  canvas  to  make  it  interpret  subsequent
       keyboard  events.   When  either  the  StringEditor or the StringBrowser relinquishes keyboard focus, the
       other acquires it: for example, the user can toggle focus  between  the  two  by  pressing  the  tab  key
       repeatedly.   If  an  entry  in  the  StringBrowser is selected when it loses focus, the (first) selected
       string will be transferred into the StringEditor.

Name

       StringChooser - dialog box for choosing items in a list

Protected Operations

StringChooser(ButtonState*,Alignment=Center)
              Construct a new StringChooser with the given button state and pop-up  alignment  without  creating
              StringBrowser  and  StringEditor  instances.  This constructor should be called in subclasses that
              require a specialized StringEditor or StringBrowser or both.

       voidInit(StringEditor*,StringBrowser*)
              Initialize the StringEditor and StringBrowser that  StringChooser  will  use.   This  function  is
              useful  in the constructors of StringChooser subclasses that require a specialized StringEditor or
              StringBrowser or both.

       virtualvoidSwitchFocus()
              Prepare to shift keyboard focus to the StringBrowser if the StringEditor is focused currently, and
              vice versa.  Focus actually changes when HandleFocus is called (see below).

       virtualbooleanCanFocus(Interactor*)
              Return whether or not the given interactor can be focused.  This function  is  used  to  determine
              whether the StringChooser should switch focus in response to a downclick.

       virtualvoidHandleFocus()
              Transfer event reading to the StringBrowser or StringEditor, whichever is the current focus.

       virtualvoidUpdateEditor()virtualvoidUpdateBrowser()
              Update StringEditor and StringBrowser state when the dialog is accepted or in response to a change
              in  focus.   This  function  guarantees  that the Choice operation will return the last choice. By
              default, UpdateEditor changes the StringEditor's contents to match the StringBrowser selection (if
              any), and UpdateBrowser clears out any selected strings in the StringBrowser.

Public Operations

StringChooser(ButtonState*,introws,intcols,constchar*sample,Alignment)StringChooser(constchar*name,ButtonState*,introws,intcols,constchar*sample,Alignment)
              Construct  a  new  StringChooser  with  the  given  button  state  and  pop-up  alignment.   These
              constructors create a StringBrowser of the specified size and a StringEditor with the given sample
              string.  The StringChooser, StringBrowser, and StringEditor all share the same button state.

       voidSelect(intpoint)voidSelect(intleft,intright)voidSelectMessage()
              Select an insertion point, a subrange, or the entire edit buffer in the StringEditor.

       voidMessage(constchar*text)
              Set the contents of the StringEditor's edit buffer to text.

       virtualconstchar*Choice()
              Return  the  chosen  string. The string is returned in a static buffer and should be copied before
              use.

See Also

Button(3I), Dialog(3I), StringBrowser(3I), StringEditor(3I)

InterViews                                      30 November 1989                               StringChooser(3I)

Synopsis

#include<InterViews/strchooser.h>

See Also