HandleConfigureNotify() in MDI environment

From: Giorgio De Nunzio <giorgio.denunzio_at_aliceposta.it>
Date: Wed, 14 Sep 2005 09:41:50 +0200

Hi again!
Some days ago Ilka helped me with some of my ROOT problems: in particular I was (and I am) working on a MDI application, and:

  1. buttons contained in TGMdiFrames did not work
  2. I did not know how to make my application be aware of manual resizing of TGMdiFrames.

Ilka told me respectively to:
1) use the ROOT head version
2) use the TGFrame::HandleConfigureNotify(Event_t *event) method.

I began using the head version, and problem 1 was solved.

Now, Problem 2:

I took mditest.C, the mother of all my MDI tests :-) Class TGMdiHintTest contains a TGMdiFrame which of course inherits from TGFrame its HandleConfigureNotify method: if I want to change this method so that it does what I wish, I can do one of two things:

  1. create a new class TGMdiFrame2 from TGMdiFrame, and change method HandleConfigureNotify:

    class TGMdiFrame2 : public TGMdiFrame {     public:

       TGMdiFrame2(TGMdiMainFrame *main, int w, int h);
       Bool_t HandleConfigureNotify(Event_t* event);  //!

    TGMdiFrame2::TGMdiFrame2(TGMdiMainFrame *main, int w, int h) :

        TGMdiFrame(main, w, h) {
    } ;

    Bool_t TGMdiFrame2::HandleConfigureNotify(Event_t* event) //!     {

       Bool_t lReturn = TGFrame::HandleConfigureNotify(event);
       cout << "RESIZING!!!!!  Event " << event->fType << endl;
       return lReturn;


then replacing "TGMdiFrame *fMdiFrame" with "TGMdiFrame2 *fMdiFrame" in class TGMdiHintTest;

b) directly derive TGMdiHintTest from TGMdiFrame, instead of having TGMdiHintTest contain a TGMdiFrame data member, and add a TGMdiHintTest::HandleConfigureNotify method:

class TGMdiHintTest : public TGMdiFrame {


//! TGMdiFrame *fMdiFrame; //!!!!!! remove this line!

   TGTextEntry *fWName;
   TGCheckButton *fClose, *fMenu, *fMin, *fMax, *fSize, *fHelp;


   TGMdiHintTest(TGMdiMainFrame *main, int w, int h);

   void HandleButtons();
   void HandleText(const char *);    

   Bool_t HandleConfigureNotify(Event_t* event); //!!!!!!    


Of course in this way I also have to modify calls like fMdiFrame->Something() to this->Something();

Both (a) and (b) do not work (by ".x mditest.C"; I do not know if compilation can change anything, yet).

What is even more curious, is that I have tried to implement method (b) in my real code, and it did not work, too. Then I took ROOT docs and I found method AddInput. Thinking it might be the solution, I added strange things like:

   AddInput((UInt_t) -1);
   AddInput(kFocusIn | kFocusOut | kExpose | kEnterNotify | kLeaveNotify |

               kSelectionNotify | kConfigureNotify | kButtonPress | kButtonDoubleClick);

and HandleConfigureNotify (and also HandleButton) began working!!!!!!! But alas, buttons began again not to work (pressing them leaves them down). Trying AddInput in mditest.C only gave me the buttons problem, but HandleConfigureNotify still does not work.

Any hint? Am I doing something wrong? I am really confused, after many tests and tries. I am not including my code because this message is alreay excessively long.. In case it is necessary, I'll do it in my next email.


Dott. Giorgio De Nunzio

Dipartimento di Scienza dei Materiali
Universita' di Lecce
Lecce (Italy)

tel. 0832 297545
fax 0832 297548

giorgio.denunzio_at_unile.it Received on Wed Sep 14 2005 - 09:38:52 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:12 MET