제 경험으로는
void __fastcall TActiveFormXImpl::PaintEvent(TObject *Sender)
{
Fire_OnPaint();
}
void __fastcall TActiveFormX::Button1Click(TObject *Sender)
{
// 여기서 위의 Fire_OnPaint()를 호출하는 방법을 찾을수 없었습니다.
// 혹시 알고 계시는 분은 알려 주세요... 감솨
}
이런 문제를 해결하려고 하면...
1. TypeLibrary editor 에서 Event함수를 추가합니다.
e.g.
...
void __fastcall OnPaint();
void __fastcall OnIn(); //추가된 Event
...
2. KeyPressEvent 함수를 아래 처럼 변경하고...
//---------------------------------------------------------------------------
void __fastcall TActiveFormXImpl::KeyPressEvent(TObject *Sender, char &Key)
{
short TempKey;
TempKey = (short)Key;
m_VclCtl->meLog->Lines->Add("Key; "+String(TempKey));
//Fire_OnKeyPress(&TempKey);
//Key = (short)TempKey;
switch(TempKey)
{
case 100:
Fire_OnIn(); //추가한 event를 호출
break;
}
}
//---------------------------------------------------------------------------
3. ActiveForm 의 버튼에서 Event를 발생시키기.
//---------------------------------------------------------------------------
void __fastcall TActiveFormX::Button1Click(TObject *Sender)
{
SendMessage(this->Handle,WM_CHAR,100,0);
}
//---------------------------------------------------------------------------
4. ActiveForm을 사용하는 프로그램에서 OnIn에 처리
//VB
Private Sub ActiveFormX1_OnIn()
MsgBox "In"
End Sub
이렇게 하면 간단합니다.
|