Derived From:BParameter
Mix-in Classes:
Declared In:media/ParameterWeb.h
Allocation:Constructor only
Class Overview

Constructor and Destructor

You never create or delete a BDiscreteParameter object yourself. Instead, call the BParameterGroup::MakeDiscreteParameter() function to create a BDiscreteParameter within the desired BParameterGroup.

Member Functions


status_t AddItem(int32 value,
                 const char* name);

Adds a new name/value pair to the list of possible values the control can take. Whenever the selection named name is chosen, the user interface application will send a value change message to the control with the specified value.

Return CodeDescription


The item was added successfully.


Not enough memory to add the item to the list.


int32 CountItems();

Returns the number of discrete values the control can take.

ItemNameAt(), ItemValueAt()

const char* CountItems(int32 value);int32 ItemValueAt(int32 value);

These functions return the name and value of the item at the specified index, where index ranges from 0 to CountItems()-1.


Selection values aren't necessarily in any sort of order, nor are they necessarily unique.


void MakeEmpty();

Removes all items from the BDiscreteParameter.

MakeItemsFromInputs(), MakeItemsFromOutputs()

void MakeItemsFromInputs();void MakeItemsFromOutputs();

These functions add all inputs or outputs as selections, where the input or output's name is used as the item's name, and the input or output's index number is used as the value of the item.

These shortcuts let you easily create the item lists for MUX-like controls, which allow the user to choose one of a number of inputs or outputs.


It's important to note that the correct inputs and outputs must already be connected to the parameter when you call either of these functions, otherwise no items will be added, since the inputs and outputs aren't there.


virtual type_code ValueType();

Returns B_INT32_TYPE, which is the data type a BDiscreteParameter's value is maintained in.

Creative Commons License
Legal Notice
This work is licensed under a Creative Commons Attribution-Non commercial-No Derivative Works 3.0 License.