/** * Create and setup QListBox lstFormQuestion * @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 lstFormQuestion_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null) { $this->lstFormQuestion = new QListBox($this->objParentObject, $strControlId); $this->lstFormQuestion->Name = QApplication::Translate('Form Question'); $this->lstFormQuestion->Required = true; if (!$this->blnEditMode) { $this->lstFormQuestion->AddItem(QApplication::Translate('- Select One -'), null); } // Setup and perform the Query if (is_null($objCondition)) { $objCondition = QQ::All(); } $objFormQuestionCursor = FormQuestion::QueryCursor($objCondition, $objOptionalClauses); // Iterate through the Cursor while ($objFormQuestion = FormQuestion::InstantiateCursor($objFormQuestionCursor)) { $objListItem = new QListItem($objFormQuestion->__toString(), $objFormQuestion->Id); if ($this->objFormAnswer->FormQuestion && $this->objFormAnswer->FormQuestion->Id == $objFormQuestion->Id) { $objListItem->Selected = true; } $this->lstFormQuestion->AddItem($objListItem); } // Return the QListBox return $this->lstFormQuestion; }