老革命遇到新问题了!CB2010,OnKeyPress不灵了!
void __fastcall TForm1::MyEditKeyPress(TObject *Sender, char &Key)
{
ShowMessage("OK");
}
//---------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TEdit *myedit= new TEdit(Form1);
myedit->OnKeyPress = MyEditKeyPress; // <----这里编译出错
myedit->Parent = Form1;
}
CB6下用得很好的代码,到CB2010就不行了,编译出错,
说什么 “不能将XX转换为TKeyPressEvent",
咋解决?
[解决办法]
void __fastcall TForm1::MyEditKeyPress(TObject *Sender, char &Key)
{
ShowMessage("OK");
}
我也遇到过,这是小阴沟里翻船,闷死苦想,蓦然回首,居然又是Unicode,是参数char &Key引起的,人家换成 wchar_t &Key了
[解决办法]
学习了,嘿嘿.看来又要IF DEFINE了.
[解决办法]