Exemple #1
0
void CDSPECSetEdit::OnShowWindow( BOOL bShow, UINT nStatus )
{
 	CDialog::OnShowWindow(bShow, nStatus);

	if (bShow)
	{
		GetDlgItem(IDC_DSPEC_STATIC_DESIRED)->SetWindowText(m_cDesired);
		// look at the allowed values to determine if the choices are from
		// a list (use combo box) or from a range of numbers (use edit/buddyspin)

		int comma_location = m_cAllowedValues.Find(',',0);

		if (comma_location != -1)  //is a comma-delimited string of discrete values
		{
			// set up combo box with the discrete list of selections
			m_bUsingComboBox = true;
			m_cEdit.ShowWindow(SW_HIDE);
			m_cSpinButton.ShowWindow(SW_HIDE);
			PopulateComboBox();
		}
		else
		{
			// set up the edit/buddyspin pair to collect a numerical value			
			m_bUsingComboBox = false;
			m_cComboBox.ShowWindow(SW_HIDE);
			InitializeEditSpinBuddyPair();
		}
	}
}
Exemple #2
0
void ItemPageUI::OnSaveItem()
{
	Item item;
	auto nameIter = m_fieldList.find(reinterpret_cast<int>(HashedString::hash_name("BaseItemComponent")));
	item.name = UtilityFormFunctions::GetTextFromWidget(nameIter->second[0].second);
	
	for (int i = 0; i < m_componentNames.size(); ++i)
	{
		Component newComp;
		newComp.name = m_componentNames[i];
		int compID = reinterpret_cast<int>(HashedString::hash_name(newComp.name.c_str()));
		auto fieldIter = m_fieldList.find(compID);
		for (int j = 0; j < fieldIter->second.size(); ++j)
		{
			Field newField;
			newField.name = fieldIter->second[j].first->GetText();
			newField.value = UtilityFormFunctions::GetTextFromWidget(fieldIter->second[j].second);
			newComp.fields.push_back(newField);
		}

		auto listIter = m_listEntryList.find(compID);
		if (listIter != m_listEntryList.end())
		{
			auto compList = listIter->second;
			List newList;
			newList.name = compList[0][0].first->GetText();
			newList.entryName = UtilityFormFunctions::GetTextFromWidget(compList[0][0].second);
			auto it = compList.begin();
			it++;
			for (; it != compList.end(); ++it)
			{
				ListEntry newListEntry;
				for (int j = 0; j < it->second.size(); ++j)
				{
					Field entryField;
					entryField.name = it->second[j].first->GetText();
					entryField.value = UtilityFormFunctions::GetTextFromWidget(it->second[j].second);
					newListEntry.fields.push_back(entryField);
				}
				newList.entries.push_back(newListEntry);
			}
			newComp.lists.push_back(newList);
		}
		item.components.push_back(newComp);
	}

	m_itemList->SetItemByID(reinterpret_cast<int>(HashedString::hash_name(item.name.c_str())), item);
	
	while (m_itemComboBox->GetItemCount() > 0)
		m_itemComboBox->RemoveItem(0);
	ClearForm();
	PopulateComboBox();
	m_saveItemButton->Show(true);
}
void ComponentPageUI::OnSaveComponentClick()
{
	Component component;

	component.name = m_componentNameEntry->GetText();
	component.isItemComponent = m_isItemComponentCheckBtn->IsActive();

	for (int i = 0; i < m_fieldEntries.size(); ++i)
	{
		Field newField;
		newField.name = m_fieldEntries[i].first->GetText(); 
		newField.valueType = m_fieldEntries[i].second->GetText();
		component.fields.push_back(newField);
	}
	
	
	for (int i = 0; i < m_listEntries.size(); ++i)
	{
		List newList;
		newList.name = m_listEntries[i].first->GetText();
		newList.entryName = m_listEntries[i].second->GetText();
		ListEntry newListEntry;
		for (int j = 0; j < m_listFieldEntries[i].size(); ++j)
		{
			Field newField;
			newField.name = m_listFieldEntries[i][j].first->GetText();
			newField.valueType = m_listFieldEntries[i][j].second->GetText();
			newListEntry.fields.push_back(newField);
		}
		newList.entries.push_back(newListEntry);
		component.lists.push_back(newList);
	}
	m_componentList->SetComponentByID(reinterpret_cast<int>(HashedString::hash_name(component.name.c_str())), component);
	while (m_componentComboBox->GetItemCount() > 0)
		m_componentComboBox->RemoveItem(0);
	PopulateComboBox();
	m_saveComponentBtn->Show(true);
}