如何将项目从CBC6降到CBC5 CBC6的兼容性问题?
CBC6是否不向下兼容呢,请分别在CBC6和CBC5中试验如下代码,CBC5中很正常但到CBC6中却不能完成任务?
void __fastcall TForm1::ComboBoxMove(TComboBox* ComboBox1,char &Key,bool bCan)
{
AnsiString Temp;
bool bo=false;
if(Key==VK_RETURN) //»Ø³µÖ±½Ó·µ»Ø
return;
if(Key==VK_BACK) //Í˸ñ¼üÇÒÓÐÑ¡
{
if(ComboBox1->SelStart==0)
ComboBox1->Text="";
ComboBox1->SelStart--;
ComboBox1->SelLength =ComboBox1->Text.Length()-ComboBox1->SelStart;
Key=0;
return;
}
if(ComboBox1->SelLength>0) //if selected then it is select else is all
Temp=ComboBox1->Text.SubString(1,ComboBox1->SelStart);
else
Temp=ComboBox1->Text;
Temp=Temp+Key;
if((unsigned)(Key)>0xA0) //If it is chinese
{
MSG Msg;
if(GetMessage(&Msg,ComboBox1->Handle,WM_KEYFIRST,WM_KEYLAST))
{
Temp=Temp+(char)(Msg.wParam); //Get the next key
}
}
Key=0;
for(int i=0;i<ComboBox1->Items->Count;i++) //²éÕÒÂú×ãÌõ¼þµÄÏî
{
if((Temp.UpperCase())==(ComboBox1->Items->Strings[i].SubString(1,Temp.Length ()).UpperCase()))
{
ComboBox1->Text=ComboBox1->Items->Strings[i];
ComboBox1->ItemIndex=i;
ComboBox1->SelStart=Temp.Length();
ComboBox1->SelLength=ComboBox1->Text.Length()-Temp.Length();
bo=true;
break;
} //found
}
if(!bo&&bCan)
{
ComboBox1->Text=Temp;
ComboBox1->SelStart=Temp.Length();
}
}
void __fastcall TForm1::ComboBox1KeyPress(TObject *Sender, char &Key)
{
ComboBoxMove(ComboBox1,Key);
}