But Memo2.3.4.5?
CodePudding user response:
CB code:TMemo * activeMemo=NULL;
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
__fastcall TForm1: : TForm1 (TComponent * Owner)
: TForm (the Owner)
{
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
//a few Memo sharing this event handler, Edit also can share
Void __fastcall TForm1: : Memo1Enter (TObject * Sender)
{
ActiveMemo=dynamic_cast & lt; TMemo * & gt; (the Sender);
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : Button1Click (TObject * Sender)
{
If (activeMemo)
ActiveMemo - & gt; Lines - & gt; Add (" A ");
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
CodePudding user response:
ActiveMemo=dynamic_cast & lt; TMemo * & gt; (the Sender);If the Sender is a TEdit *, activeMemo is NULL,
CodePudding user response:
This post a truth with youhttps://bbs.csdn.net/topics/392370743
CodePudding user response:
Strange strange, I can't post why show?Already the third time,
CodePudding user response:
Method one: determine the current focus controls;Method 2: MemoX gains focus when the event to change the input corresponding Memo,
Methods N, how to can have a lot of way,
CodePudding user response: