Re: How to connect a menu with some commands

Fons Rademakers (Fons.Rademakers@cern.ch)
Mon, 08 Jun 1998 11:49:52 +0200


Hi Xie,

macros cannot call virtual functions of compiled base classes.
To make a macro that is doing what you want you need to use
object composition, as shown in the macro $ROOTSYS/dialogs.C,
which I recently published.

Cheers, Fons.

Wei Xie wrote:
>
> Dear Rooters'
>
> The following test macro can produce a frame with
> three popup menus: Test, Cancel, Help.
>
> I failed to connect them with commands that can
> be activated by a mouse click. For example, when click "Close",
> it would not print:
>
> "deleteing the windows".
>
> I'v tried to use the function "Associate(this)" but it make no sense.
>
> Could you tell me what is the problem ?
>
> Many thanks
>
> Xie
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> * The test macro *:
> ^^^^^^^^^^^^^^^^^^^
>
> //name: test.c
> // when running, please do the following steps:
> // .L test.c
> // new TestMainFrame(gClient->GetRoot(),400,300);
>
> enum values
> {M_FILE_OPEN, M_FILE_CLOSE, M_FILE_CANCEL, M_FILE_HELP_COMMAND };
>
> class TestMainFrame : public TGMainFrame

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910