Пример #1
0
void ddAddColButtonHandle::invokeStart(hdMouseEvent &event, hdDrawingView *view)
{
	ddTableFigure *table = (ddTableFigure *) getOwner();
	wxTextEntryDialog nameDialog(view, wxT("New column name"), wxT("Add a column"));
	bool again;
	do
	{
		again = false;
		int answer = nameDialog.ShowModal();
		if (answer == wxID_OK)
		{
			wxString name = nameDialog.GetValue();
			if(table->getColByName(name) == NULL)
			{
				table->addColumn(view->getIdx(), new ddColumnFigure(name, table));
				view->notifyChanged();
			}
			else
			{
				wxString msg(wxT("Error trying to add new column '"));
				msg.Append(name);
				msg.Append(wxT("' column name already in use"));
				wxMessageDialog info( view, msg ,
				                      wxT("Column name already in use"),
				                      wxNO_DEFAULT | wxOK | wxICON_EXCLAMATION);
				again = true;
				info.ShowModal();
			}
		}

	}
	while(again);
	view->Refresh();
}
Пример #2
0
void frmDatabaseDesigner::OnAddColumn(wxCommandEvent &event)
{
	if (diagrams->GetPageCount() > 0)
	{
		hdDrawingView *view = (hdDrawingView *) diagrams->GetPage(diagrams->GetSelection());
		ddTableFigure *table = design->getSelectedTable(view->getIdx());
		wxTextEntryDialog nameDialog (this, wxT("New column name"), wxT("Add a column"), wxT("NewColumn"));
		int answer;
		wxString tmpString;

		if (table)
		{
			bool again;
			do
			{
				again = false;
				answer = nameDialog.ShowModal();
				if (answer == wxID_OK)
				{
					tmpString = nameDialog.GetValue();
					if(table->getColByName(tmpString) == NULL)
					{
						table->addColumn(view->getIdx(), new ddColumnFigure(tmpString, table));
						setModelChanged(true);
						setExtendedTitle();
					}
					else
					{
						wxString msg(wxT("Error trying to add new column '"));
						msg.Append(tmpString);
						msg.Append(wxT("' column name already in use"));
						wxMessageDialog info( this, msg ,
						                      wxT("Column name already in use"),
						                      wxNO_DEFAULT | wxOK | wxICON_EXCLAMATION);
						again = true;
						info.ShowModal();
					}

				}
			}
			while(again);
		}
		view->Refresh();
	}
	else
	{
		wxMessageBox(_("Warning about adding a column to a table without a diagram"), _("Please create a model diagram first"), wxICON_EXCLAMATION | wxOK);
	}
}
bool EditConfigWindow::getNewName(QString& newName)
{
    bool rc = false;
    std::set<QString> existingNames;
    for (const auto& it : m_config->m_map)
        existingNames.insert(QString::fromStdString(it.first));
    
    NewParameterNameDialog nameDialog(existingNames, this);
    if (nameDialog.exec() == 1)
    {
        newName = nameDialog.getNewName();
        rc = true;
    }

    return rc;
}