/** * Create and setup QListBox lstStateProvince * @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 lstStateProvince_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null) { $this->lstStateProvince = new QListBox($this->objParentObject, $strControlId); $this->lstStateProvince->Name = QApplication::Translate('State Province'); $this->lstStateProvince->AddItem(QApplication::Translate('- Select One -'), null); // Setup and perform the Query if (is_null($objCondition)) { $objCondition = QQ::All(); } $objStateProvinceCursor = StateProvince::QueryCursor($objCondition, $objOptionalClauses); // Iterate through the Cursor while ($objStateProvince = StateProvince::InstantiateCursor($objStateProvinceCursor)) { $objListItem = new QListItem($objStateProvince->__toString(), $objStateProvince->StateProvinceId); if ($this->objAddress->StateProvince && $this->objAddress->StateProvince->StateProvinceId == $objStateProvince->StateProvinceId) { $objListItem->Selected = true; } $this->lstStateProvince->AddItem($objListItem); } // Return the QListBox return $this->lstStateProvince; }