void frmDatabaseDesigner::Go()
{
	cbConnection->SetSelection(0L);

	if (connection)
	{
		wxCommandEvent event;
		OnChangeConnection(event);
	}

	loading = false;
	Show(true);
}
void frmDatabaseDesigner::OnChangeConnection(wxCommandEvent &event)
{
	// On Solaris, this event seems to get fired when the form closes(!!)
	if(!IsVisible() && !loading)
		return;

	unsigned int sel = cbConnection->GetSelection();
	if (sel == cbConnection->GetCount() - 1)
	{
		// new Connection
		dlgSelectConnection dlg(this, mainForm);
		int rc = dlg.Go(connection, cbConnection);
		if (rc == wxID_OK)
		{
			bool createdNewConn;
			wxString applicationname = appearanceFactory->GetLongAppName() + _(" - Database Designer");
			pgConn *newconn = dlg.CreateConn(applicationname, createdNewConn);
			if (newconn && createdNewConn)
			{
#if wxCHECK_VERSION(2, 9, 0)
				cbConnection->Insert(newconn->GetName(), CreateBitmap(GetServerColour(newconn)), sel, (wxClientData *)newconn);
#else
				cbConnection->Insert(newconn->GetName(), CreateBitmap(GetServerColour(newconn)), sel, (void *)newconn);
#endif
				cbConnection->SetSelection(sel);
				OnChangeConnection(event);
			}
			else
				rc = wxID_CANCEL;
		}
		if (rc != wxID_OK)
		{
			unsigned int i;
			for (i = 0 ; i < sel ; i++)
			{
				if (cbConnection->GetClientData(i) == connection)
				{
					cbConnection->SetSelection(i);
					break;
				}
			}
		}
	}
	else
	{
		connection = (pgConn *)cbConnection->GetClientData(sel);
		setExtendedTitle();
	}
}