Home > Back-end >  Ask a question of components
Ask a question of components

Time:10-19

Is that I have a lot of Edit interface components, each Edit component has the Exit events; I want to perform other operations in the middle of the main interface (such as selection menu), performs the current Edit Edit Exit event, if one by one to call Exit events will be very troublesome, I want to get the current Edit
 
TEdit * PEdit;
PEdit=dynamic_cast & lt; TEdit * & gt; (VP350Form - & gt; ActiveControl);
If (PEdit!=NULL)
{
PEdit - & gt; OnExit;
}


So I corresponding Edit component or by the Exit, to ask how to fix it,

CodePudding user response:

Perform other operations, such as selecting menu), the current activity, it is not a TEdit control,
At this point the VP350Form - & gt; Rather than a TEdit ActiveControl is the menu

CodePudding user response:

> Each Edit component has the Exit events
The optimization of the space is too big,

To take over the Screen OnActiveControlChange events, you will have a surprise,

CodePudding user response:

reference 1st floor sololie response:
perform other operations (e.g., select menu), when the current activity of controls, it is not a TEdit,
At this point the VP350Form - & gt; ActiveControl is menu rather than TEdit
is that when I get to the current Edit, just want to call its Exit events,

CodePudding user response:

refer to the second floor ccrun response:
& gt;> Each Edit component has the Exit events
The optimization of the space is too big,

To take over the Screen OnActiveControlChange events, you will be pleasantly surprised,
implementation demon elder brother? Don't understand

CodePudding user response:

refer to the second floor ccrun response:
& gt;> Each Edit component has the Exit events
The optimization of the space is too big,

To take over the Screen OnActiveControlChange events, you will be pleasantly surprised,
OnActiveControlChange this event?

CodePudding user response:

 

//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

# # ifndef Unit1H
# define Unit1H
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
#include
#include
#include
#include
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The class TForm1: public TForm
{
__published://IDE - managed Components
TEdit * edt1;
TEdit * edt2;
Void __fastcall FormDestroy (TObject * Sender);
Void __fastcall edt1Exit (TObject * Sender);
Void __fastcall edt2Exit (TObject * Sender);
Private://User declarations
TNotifyEvent Org_OnActiveControlChange;
Public://User declarations
__fastcall TForm1 (TComponent * Owner);
Void __fastcall MyCB_OnActiveControlChange (TObject * Sender);

};
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Extern PACKAGE TForm1 * Form1;
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# endif

//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

#include
# pragma hdrstop

# include "Unit1. H"
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# pragma package (smart_init)
# pragma resource "*. DFM
"TForm1 * Form1;
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
__fastcall TForm1: : TForm1 (TComponent * Owner)
: TForm (the Owner)
{
Screen - & gt; OnActiveControlChange=MyCB_OnActiveControlChange;
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : MyCB_OnActiveControlChange (TObject * Sender)
{
TEdit * pEdt;
PEdt=dynamic_cast & lt; TEdit * & gt; (the Sender);
If (pEdt!=NULL & amp; & PEdt - & gt; The Tag)
{
PEdt - & gt; OnExit;
}
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : edt1Exit (TObject * Sender)
{
ShowMessage (" controls the Name is "+ ((TEdit *) Sender) - & gt; Name);
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : edt2Exit (TObject * Sender)
{
ShowMessage (" control Text is "+ ((TEdit *) Sender) - & gt; The Text);
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : FormDestroy (TObject * Sender)
{
Screen - & gt; OnActiveControlChange=NULL;
}

CodePudding user response:

If (pEdt!=NULL & amp; & PEdt - & gt; The Tag)
& & PEdt - & gt; The Tag is superfluous, forget to delete the

CodePudding user response:

The original poster to learn to self learning, don't stretch out his hand, never take OnActiveControlChange how to use this problem, Google it, there are too many code,

Google "site:csdn.net ccrun Screen OnActiveControlChange"
  • Related