void CInstrumentEditDlg::InsertPane(CInstrumentEditPanel *pPanel, bool Show)
{
	CRect Rect, ParentRect;
	CTabCtrl *pTabControl = static_cast<CTabCtrl*>(GetDlgItem(IDC_INST_TAB));

	pPanel->SetInstrumentManager(m_pInstManager);		// // //

	pTabControl->GetWindowRect(&ParentRect);
	pTabControl->InsertItem(m_iPanels, pPanel->GetTitle());

	pPanel->Create(pPanel->GetIDD(), this);
	pPanel->GetWindowRect(&Rect);
	Rect.MoveToXY(ParentRect.left - Rect.left + DPI::SX(1), ParentRect.top - Rect.top + DPI::SY(21));
	Rect.bottom -= DPI::SY(2);
	Rect.right += DPI::SX(1);
	pPanel->MoveWindow(Rect);
	pPanel->ShowWindow(Show ? SW_SHOW : SW_HIDE);

	if (Show) {
		pTabControl->SetCurSel(m_iPanels);
		pPanel->SetFocus();
		m_pFocusPanel = pPanel;
	}

	m_pPanels[m_iPanels++] = pPanel;
}
// @pymethod int|PyCTabCtrl|SetCurSel|Sets the current selection of a tab control.
PyObject *ui_tabctrl_set_cur_sel( PyObject *self, PyObject *args )
{
	CTabCtrl *pTab;
	if (!(pTab=PyGetTabCtrlWithWnd(self)))
		return NULL;
	int tab;
	// @pyparm int|index||The index of the tab to set current.
	if (!PyArg_ParseTuple( args, "i", &tab))
		return NULL;
	int rc = pTab->SetCurSel(tab);
	if (rc==-1)
		RETURN_ERR("SetCurSel failed");
	return Py_BuildValue("i", rc);
	// @rdesc The zero-based index of the previously selected item.
}