Board index » cppbuilder » The important specification of previous question by the author.

The important specification of previous question by the author.


2004-10-13 06:18:24 PM
cppbuilder46
Hello . I ask to inform whether can for dynamically ( in run-time of the program ) created Memoes , amount of Memoes beforehand is not determined , to exist event handlers ?
Whether can exist event handlers for dynamically created Memoes?
This important addition. It is necessary that event handler for everyone Memoes was special.
 
 

Re:The important specification of previous question by the author.

You can create TMemos dynamically but you must have the event handlers
defined at compile time.
If you want, you can create a Frame which includes a TMemo and all it's
event handlers and then create the Frame at run time and it will have all
the event handlers it needs.
This is the method I use for multiple tabbed editors.
HTH Pete
"Victor" < XXXX@XXXXX.COM >wrote in message
Quote

Hello . I ask to inform whether can for dynamically ( in run-time of the
program ) created Memoes , amount of Memoes beforehand is not determined ,
to exist event handlers ?
Whether can exist event handlers for dynamically created Memoes?
This important addition. It is necessary that event handler for everyone
Memoes was special.
 

Re:The important specification of previous question by the author.

Victor wrote:
Quote
It is necessary that event handler for everyone Memoes was special.
You can define as many different eventhandlers as you want.
Every eventhandler can be assigned to several TMemo's. In that
case the Sender parameter is the actual TMemo.
Hans.
 

{smallsort}

Re:The important specification of previous question by the author.

"Victor" < XXXX@XXXXX.COM >wrote:
Quote

[...] amount of Memoes beforehand is not determined,
[...] It is necessary that event handler for everyone Memoes
was special.
Why do you think that each memo needs a seperate set of events?
//-------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
static int Count = 0;
TMemo *pMemo = new TMemo( this );
pMemo->Parent = this;
pMemo->Left = 10 + Count * 10;
pMemo->Top = 10 + Count * 10;
pMemo->OnClick = MemoClick;
++Count;
}
//-------------------------------------------------------------
void __fastcall TForm1::MemoClick(TObject *Sender)
{
TMemo *pMemo = static_cast<TMemo*>( Sender );
pMemo->BringToFront();
}
//-------------------------------------------------------------
~ JD
 

Re:The important specification of previous question by the author.

JD wrote:
Quote
void __fastcall TForm1::MemoClick(TObject *Sender)
{
TMemo *pMemo = static_cast<TMemo*>( Sender );
pMemo->BringToFront();
When clicked, it is already to the front.
pMemo->BringToBack();
Would be more spectacular.
Hans.
 

Re:The important specification of previous question by the author.

Hans Galema < XXXX@XXXXX.COM >wrote:
Quote
JD wrote:

>void __fastcall TForm1::MemoClick(TObject *Sender)
>{
>TMemo *pMemo = static_cast<TMemo*>( Sender );
>pMemo->BringToFront();

When clicked, it is already to the front.
Not always true. The code I posted would create the Memo's in
a fashion similar to how multiple instances of an MDIChild
form are displayed:
+------------+
|(Memo1) |
| +------------+
| |(Memo2) |
| | +-----------+
| | |(Memo3) |
+---| | |
| | |
+---| |
| |
+-----------+
Quote
pMemo->BringToBack();

Would be more spectacular.
True - if you wanted to make it difficult for the user to use
the memo <g>
~ JD