QListControl::AddItemAt PHP Method

AddItemAt() public method

Allows you to add a QListItem to this QListControl at a specific location in the current item array
public AddItemAt ( integer $intIndex, QListItem $objListItem )
$intIndex integer the index of the location to add the new item to
$objListItem QListItem the item to add
    public function AddItemAt($intIndex, QListItem $objListItem)
    {
        $this->blnModified = true;
        try {
            $intIndex = QType::Cast($intIndex, QType::Integer);
        } catch (QInvalidCastException $objExc) {
            $objExc->IncrementOffset();
            throw $objExc;
        }
        if ($intIndex < 0 || $intIndex > count($this->objItemsArray)) {
            throw new QIndexOutOfRangeException($intIndex, "AddItemAt()");
        }
        for ($intCount = count($this->objItemsArray); $intCount > $intIndex; $intCount--) {
            $this->objItemsArray[$intCount] = $this->objItemsArray[$intCount - 1];
        }
        $this->objItemsArray[$intIndex] = $objListItem;
    }