PoDoFo 0.9.20
PoDoFo::PdChoiceField Class Reference

#include <PdfChoiceField.h>

Inheritance diagram for PoDoFo::PdChoiceField:
PoDoFo::PdfComboBox PoDoFo::PdfListBox

Public Member Functions

void InsertItem (const PdfString &value, nullable< const PdfString & > displayName={ })
 
void RemoveItem (unsigned index)
 
PdfString GetItem (unsigned index) const
 
nullable< const PdfString & > GetItemDisplayText (int index) const
 
unsigned GetItemCount () const
 
void SetSelectedIndex (int index)
 
int GetSelectedIndex () const
 
bool IsComboBox () const
 
void SetSpellcheckingEnabled (bool spellCheck)
 
bool IsSpellcheckingEnabled () const
 
void SetSorted (bool sorted)
 
bool IsSorted () const
 
void SetMultiSelect (bool multi)
 
bool IsMultiSelect () const
 

Detailed Description

A list of items in a PDF file. You cannot create this object directly, use PdfComboBox or PdfListBox instead.

See also
PdfComboBox
PdfListBox

Member Function Documentation

◆ GetItem()

PdfString PdChoiceField::GetItem ( unsigned index) const
Parameters
indexindex of the item
Returns
the value of the item at the specified index

◆ GetItemCount()

unsigned PdChoiceField::GetItemCount ( ) const
Returns
the number of items in this list

◆ GetItemDisplayText()

nullable< const PdfString & > PdChoiceField::GetItemDisplayText ( int index) const
Parameters
indexindex of the item
Returns
the display text of the item or if it has no display text its value is returned. This call is equivalent to GetItem() in this case
See also
GetItem

◆ GetSelectedIndex()

int PdChoiceField::GetSelectedIndex ( ) const

Sets the currently selected item

Returns
the selected item or -1 if no item was selected

◆ InsertItem()

void PdChoiceField::InsertItem ( const PdfString & value,
nullable< const PdfString & > displayName = { } )

Inserts a new item into the list

Parameters
valuethe value of the item
displayNamean optional display string that is displayed in the viewer instead of the value

◆ IsComboBox()

bool PdChoiceField::IsComboBox ( ) const
Returns
true if this PdChoiceField is a PdfComboBox and false if it is a PdfListBox

◆ IsMultiSelect()

bool PdChoiceField::IsMultiSelect ( ) const
Returns
true if multi selection is enabled for this list

◆ IsSorted()

bool PdChoiceField::IsSorted ( ) const
Returns
true if sorting is enabled

◆ IsSpellcheckingEnabled()

bool PdChoiceField::IsSpellcheckingEnabled ( ) const
Returns
true if spellchecking is enabled for this combobox

◆ RemoveItem()

void PdChoiceField::RemoveItem ( unsigned index)

Removes an item for the list

Parameters
indexindex of the item to remove

◆ SetMultiSelect()

void PdChoiceField::SetMultiSelect ( bool multi)

Sets whether multiple items can be selected by the user in the list.

Parameters
multiif true multiselect will be enabled

By default multiselection is turned off.

◆ SetSelectedIndex()

void PdChoiceField::SetSelectedIndex ( int index)

Sets the currently selected item

Parameters
indexindex of the currently selected item

◆ SetSorted()

void PdChoiceField::SetSorted ( bool sorted)

Enable or disable sorting of items. The sorting does not happen in acrobat reader but whenever adding items using PoDoFo or another PDF editing application.

Parameters
sortedenable/disable sorting

◆ SetSpellcheckingEnabled()

void PdChoiceField::SetSpellcheckingEnabled ( bool spellCheck)

Enable/disable spellchecking for this combobox

Parameters
spellCheckif true spellchecking will be enabled

combobox are spellchecked by default