Class: TDropDownTextControl

Declaration: DropDownTextControl.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TView, MControl

Inherited By:

None.

Purpose:

TDropDownTextControl provides management control for the Drop Down text entry screen. This screen is composed of a toggle button, a text entry field, and a scrolling list. Text information can be entered by either selecting from the items in the predefined entry list, or by typing text into the entry field. TDropDownTextControl provides the API to control the text field, the drop-down list, and the toggle button. This API allows the developer to change the behavior and the look of the control screen. It also provides functions for handling specific actions generated by individual controls.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

You should not derive from this class since it is composed of three specific controls.

Concurrency:

Multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TDropDownTextControl::TDropDownTextControl

  1. TDropDownTextControl ()
  2. TDropDownTextControl (MDropDownListControlState * stateToAdopt)
  3. TDropDownTextControl (TSequenceOf < TText > * listToAdopt, unsigned long selectedIndex =TDropDownTextControl :: kInvalidIndex)
  4. TDropDownTextControl (const TDropDownTextControl & copy)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Creates a new TDropDownTextControl object using the pointer to the abstract control state for the drop-down list entries.
  3. Creates a new TDropDownTextControl object using the specified list of drop-down list entries.
  4. Copy constructor.

Calling Context:

  1. Called by the stream-in operators and derived classes.
  2. Called to create a new drop-down text control screen from a given list control state.
  3. Called to create a new drop-down text control screen using the list of text entries.
  4. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::~TDropDownTextControl

virtual ~ TDropDownTextControl ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::operator=

TDropDownTextControl & operator =(const TDropDownTextControl &)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::operator>>=

virtual TStream & operator >>=(TStream &) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::operator<<=

virtual TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::AdoptState

virtual void AdoptState (MDropDownListControlState * stateToAdopt)

Interface Category:

API.

Purpose:

Adopts the referenced list control state and incorporates its items into the drop-down list display.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::OrphanState

virtual MDropDownListControlState * OrphanState ()

Interface Category:

API.

Purpose:

Releases and frees a previously adopted list control state.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a pointer to the orphaned MDropDownListControlState object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::GetState

virtual const MDropDownListControlState * GetState () const

Interface Category:

API.

Purpose:

Gets a reference pointer to the MDropDownListControlState object currently associated with the drop-down text control object.

Calling Context:

Call this function directly to get a reference of list control state object.

Parameters:

Return Value:

Returns a pointer to the current MDropDownListControlState object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::AdoptTextState

virtual void AdoptTextState (MTextControlState * stateToAdopt)

Interface Category:

API.

Purpose:

This is a convenience function for changing the state of the TTextControl object. This function sets TTextControl to the new MTextControlState object. This function calls the appropriate TTextControl function for the developer.

Calling Context:

Call this function directly to change the TTextControl state to a new object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::OrphanTextState

virtual MTextControlState * OrphanTextState ()

Interface Category:

API.

Purpose:

This is a convenience function for changing the state of the TTextControl object. This function releases the MTextControlState object from TTextControl and calls the appropriate TTextControl function for the developer.

Calling Context:

Call this function directly to release the TTextControl state from the MTextControlState object.

Parameters:

Return Value:

Returns a pointer to the released MTextControlState object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::GetTextState

virtual const MTextControlState * GetTextState () const

Interface Category:

API.

Purpose:

This is a convenience function for getting information on the state of the TTextControl object. This function gets the MTextControlState object associated with TTextControl and calls the appropriate TTextControl function for the developer.

Calling Context:

Call this function directly to get a reference of TTextControl state.

Parameters:

Return Value:

Returns a pointer to the released MTextControlState object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::CanChangeList

virtual bool CanChangeList () const

Interface Category:

API.

Purpose:

Returns a Boolean value that indicates whether the predefined text list can be changed.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the Boolean value that indicates if the predefined list can be changed.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::AdoptList

virtual void AdoptList (TSequenceOf < TText > * listToAdopt)

Interface Category:

API.

Purpose:

Adds a new predefined list to the drop-down text control object. This list becomes the selection list that is displayed to the user.

Calling Context:

Call this function directly to customize the predefined drop-down list.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::OrphanList

virtual TSequenceOf < TText > * OrphanList ()

Interface Category:

API.

Purpose:

Releases a previously adopted list of text entries for the drop-down text control.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a pointer to the just released list of text entries.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::CreateIterator

virtual TDropDownTextControlIterator * CreateIterator (const TAllocationHeap & whichHeap) const

Interface Category:

API.

Purpose:

Creates an iterator for accessing the text entries in the drop-down list.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a pointer to the TDropDownTextControlIterator iterator.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::GetPreferredSize

virtual TGPoint GetPreferredSize (GCoordinate maximumMainDimension =kInfinity) const

Interface Category:

API.

Purpose:

This function allows the developer to find out the minimum/preferred size to fit the drop-down text control. If the control has an empty list, the default size is 100 x 25. If control has a predefined list, it returns the largest item in the list, plus the preferred size of the button. Developer can override this functions to change the preferred size.

Calling Context:

Call this function directly to get the preferred screen size.

Parameters:

Return Value:

Returns the TGPoint coordinates for the screen.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::NeedsClipping

virtual bool NeedsClipping ()

Interface Category:

API.

Purpose:

Returns a Boolean value that indicates whether the drop-down text control screen needs clipping.

Calling Context:

Call by the View system to check if the drop-down text control will need clipping.

Parameters:

Return Value:

Returns a Boolean value that is set to true if clipping is needed.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::SetVisibility

virtual void SetVisibility (bool visible =true)

Interface Category:

API.

Purpose:

Changes the semantic visibility of this drop-down text control view. If the view becomes visible, it is repaired (refreshed). If the view becomes invisible, its previously visible area is refreshed to make the newly exposed areas appear on the display. This function overrides the View system settings.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::GetVisibility

virtual bool GetVisibility () const

Interface Category:

API.

Purpose:

Returns the semantic visibility of this view. This value only indicates whether this view would be visible if it was not completely occluded by siblings and if all of its parent views are also semantically visible. Use this function to override the View system function.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if this view is not marked as semantically invisible.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::GetBounds

virtual void GetBounds (TGArea &) const

Interface Category:

API.

Purpose:

Gets the current bounds of the display area.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::SetControlLayout

virtual void SetControlLayout (MControl :: ELayout layout)

Interface Category:

API.

Purpose:

Sets the drop-down text control layout. It allows the developer to override the default layout, which is from LeftToRight.

Calling Context:

Call this function directly to change the default layout.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

Currently only LeftToRight is supported.

Member Function: TDropDownTextControl::GetControlLayout

virtual MControl :: ELayout GetControlLayout () const

Interface Category:

API.

Purpose:

Returns the layout orientation that is currently set.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the enum value that indicates the currently set layout for the drop-down text control display--either right-to-left or left-to-right.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::SetEnabled

virtual void SetEnabled (bool flag)

Interface Category:

API.

Purpose:

Sets the Boolean value that indicates that the control is enabled.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::IsEnabled

virtual bool IsEnabled () const

Interface Category:

API.

Purpose:

Returns the Boolean value that indicates whether the control is enabled.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the Boolean value that indicates if the control is enabled; if set to true, the control is enabled.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::Activate

virtual bool Activate ()

Interface Category:

API.

Purpose:

Activates the text entry field so that text can be input into it.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a Boolean value that indicates that the field is activated.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::Deactivate

virtual void Deactivate ()

Interface Category:

API.

Purpose:

Sets the text entry field to inactive and puts the control back to the default state (if drop-down list is down, it will roll up and the button will unpress).

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::IsActive

virtual bool IsActive () const

Interface Category:

API.

Purpose:

Returns the Boolean value that indicates whether the text entry field is currently active. If the value is true, the text entry has been activated.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the text entry field is active; otherwise, returns false if it has not been activated.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::SetValue

void SetValue (const TText &)

Interface Category:

API.

Purpose:

Sets the text entry field to the text constant so that it is displayed.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::GetValue

void GetValue (TText & text) const

Interface Category:

API.

Purpose:

Retrieves the text value that has been entered into the text entry field.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::SetSelectedField

void SetSelectedField (bool selected =true) const

Interface Category:

API.

Purpose:

Highlights or unhighlights the text entry field.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::SetReadOnly

void SetReadOnly (bool flag)

Interface Category:

API.

Purpose:

Sets the text entry field to either read-only or editable.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::IsReadOnly

bool IsReadOnly () const

Interface Category:

API.

Purpose:

Gets the Boolean value that determines whether the text entry field is editable or is read-only. If the value is true, then the field is read-only.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the text entry field is read-only; otherwise, returns false if the field is editable.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::SetListSelection

void SetListSelection (unsigned long index, bool flag)

Interface Category:

API.

Purpose:

Sets or unsets the selected item (by its position in the list) from the list of predefined choices. The selected item is highlighted.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::GetSelectedIndex

unsigned long GetSelectedIndex () const

Interface Category:

API.

Purpose:

Gets the index value for the item that has been selected from the list. The index value is the item's position within the list.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the index value of the selected list item. If no item has been selected, returns kInvalidIndex.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::ClearListSelection

void ClearListSelection () const

Interface Category:

API.

Purpose:

Clears the selected indicator for the list item and unhighlights that item.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::GetItemCount

virtual unsigned long GetItemCount () const

Interface Category:

API.

Purpose:

Gets the number of items that are currently in the scrolling list.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the value that indicates the number of items in the list. Returns 0 if empty.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::GetItemFromIndex

virtual bool GetItemFromIndex (unsigned long index, TText & textToFill) const

Interface Category:

API.

Purpose:

Retrieves the text value from an item in the scroll list, according to the index position of that item.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the item was successfully found and its text retrieved; otherwise, returns false.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::GetIndexFromItem

virtual unsigned long GetIndexFromItem (const TText & item) const

Interface Category:

API.

Purpose:

Returns the index position in the scroll list of the specified item.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the index value that indicates the position of the item in the scroll list.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::SetListMaxDisplayItem

void SetListMaxDisplayItem (unsigned long size =kDefaultListMaxDisplayItem)

Interface Category:

API.

Purpose:

Sets the maximum number of items that can be displayed in the scroll list before a scrollbar shows up.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::GetListMaxDisplayItem

unsigned long GetListMaxDisplayItem () const

Interface Category:

API.

Purpose:

Returns the maximum number of scroll list items that can be displayed when the TScrollingList object is dropped down.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a value that indicates the maximum number of items that the scroll list has been set to display.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::HandleReturnKeyEvent

virtual bool HandleReturnKeyEvent ()

Interface Category:

API.

Purpose:

Processes the user keyboard input of the Return key. Currently, this function highlights the text field.

Calling Context:

Called when a Return key was input in the text field.

Parameters:

Return Value:

Returns true if the Return key input is handled successfully; otherwise, returns false.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::HandleAfterConnectionToViewRoot

virtual void HandleAfterConnectionToViewRoot ()

Interface Category:

API.

Purpose:

Overrides the associated TView function. It is used for notification of when the drop-down view is connected to the view root hierarchy, so that display of the drop-down view will occur.

Calling Context:

This function is called internally by the View system.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::HandleBeforeDisconnectionFromViewRoot

virtual void HandleBeforeDisconnectionFromViewRoot ()

Interface Category:

API.

Purpose:

Overrides the associated TView function. It is used for notification of when the drop-down view is disconnected from the view root hierarchy.

Calling Context:

This function is called internally by the View system.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::DrawContents

virtual void DrawContents (TGrafPort & port) const

Interface Category:

API.

Purpose:

Draws the contents of the drop-down view to the specified TGrafPort.

Calling Context:

This function is called internally when the drop-down view is to be redrawn.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::HandleAllocatedAreaChanged

virtual void HandleAllocatedAreaChanged (const TGArea & newArea)

Interface Category:

API.

Purpose:

Handles notification of a change to the drop-down view's allocated area, so that appropriate changes can be made to its layout.

Calling Context:

This function is called internally when allocated area is changed.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::HandleStateChanged

virtual void HandleStateChanged (const TNotification &)

Interface Category:

API.

Purpose:

Updates the control display to reflect any changes that have occurred to the control state.

Calling Context:

This function is called internally when its state is changed.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::Layout

virtual void Layout ()

Interface Category:

API.

Purpose:

Handles any changes made to the drop-down view layout. These are changes to the border, the text entry field, and the toggle button.

Calling Context:

This function is called internally.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TDropDownTextControl::HandleParentWindowChanged

virtual void HandleParentWindowChanged (const TNotification &)

Interface Category:

API.

Purpose:

Handles moving the scroll list display position when the parent window has been moved.

Calling Context:

This function is called internally when its parent has been moved or changed size.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.