ct.Width()<480?rect.Width()*4/5:rect.Width()-120;
CString str[5];
str[0]="增加";
str[1]="修改";
str[2]="删除";
str[3]="保存";
str[4]="取消";
for(int i=0;i<5;i++)
{
this->m_btn[i].Create(str[i],WS_CHILD|WS_TABSTOP,rect,this,ID_BUTTONS_1+i);
rect.OffsetRect(-rect.Width(),0);
}
return true;
}
void CBaseTabCtrl::OnBaoCunClick()
{
m_btn[0].EnableWindow(true);
m_btn[1].EnableWindow(true);
m_btn[2].EnableWindow(true);
m_btn[3].EnableWindow(false);
m_btn[4].EnableWindow(false);
EnableBaseInfo(false);
}
BOOL CBaseTabCtrl::PreTranslateMessage(MSG* pMsg)
{ const HWND hwnd=(pMsg!=NULL)?pMsg->hwnd:NULL;
if(hwnd==NULL)
{
goto a;
}
if(pMsg->message==WM_KEYDOWN&&(pMsg->wParam==13||pMsg->wParam==VK_TAB))
{
int i=this->GetCurSel();
if(i==0)
{
this->SetListFocus(pMsg);
}
else if(i==1)
{
if(pMsg->wParam==VK_TAB)
this->SetTheFocus() ;
else
{
int iID=::GetDlgCtrlID(hwnd);
if(iID>200&&iID<206)
{
::PostMessage(this->GetSafeHwnd(),WM_COMMAND,iID,(UINT)hwnd);
this->SetFocus();
}
}
this->SetTheBaseInfoFocus();
}
pMsg->wParam=VK_CONTROL;
}
a:
return CTabCtrl::PreTranslateMessage(pMsg);
}
void CBaseTabCtrl::OnZengJiaClick()
{
this->baseinfo_state=ZENGJIA;
for(int i=0;i<this->mc_iNumber;i++)
this->m_edits[i].SetWindowText("");
this->EnableBaseInfo(true);
m_btn[3].EnableWindow(true);
m_btn[0].EnableWindow(false);
m_btn[1].EnableWindow(false);
m_btn[2].EnableWindow(false);
m_btn[4].EnableWindow(true);
m_edits[0].SetFocus();
}
void CBaseTabCtrl::OnShanChuClick()
{
this->baseinfo_state=SHANCHU;
for(int i=0;i<this->mc_iNumber;i++)
this->m_edits[i].SetWindowText("");
/* this->EnableBaseInfo(true);
CString sql;
sql.Format("delete * from %s where %s = '%s'",m_sTable,key_field,key_value);
m_runsql.RunSQL(sql);
m_btn[0].EnableWindow(true);
m_btn[1].EnableWind
上一篇:
BaseStatic.cpp
下一篇:
法律专业开题报告范文