/** * Create and setup QListBox lstGroupCategory * @param string $strControlId optional ControlId to use * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query * @return QListBox */ public function lstGroupCategory_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null) { $this->lstGroupCategory = new QListBox($this->objParentObject, $strControlId); $this->lstGroupCategory->Name = QApplication::Translate('Group Category'); $this->lstGroupCategory->AddItem(QApplication::Translate('- Select One -'), null); // Setup and perform the Query if (is_null($objCondition)) { $objCondition = QQ::All(); } $objGroupCategoryCursor = GroupCategory::QueryCursor($objCondition, $objOptionalClauses); // Iterate through the Cursor while ($objGroupCategory = GroupCategory::InstantiateCursor($objGroupCategoryCursor)) { $objListItem = new QListItem($objGroupCategory->__toString(), $objGroupCategory->GroupId); if ($objGroupCategory->GroupId == $this->objGroup->Id) { $objListItem->Selected = true; } $this->lstGroupCategory->AddItem($objListItem); } // Because GroupCategory's GroupCategory is not null, if a value is already selected, it cannot be changed. if ($this->lstGroupCategory->SelectedValue) { $this->lstGroupCategory->Enabled = false; } // Return the QListBox return $this->lstGroupCategory; }