Index: trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc	(revision 586)
+++ trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc	(revision 587)
@@ -83,6 +83,7 @@
   fTop2->AddFrame( fLabelEvtNr, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10)) ; 
 
-  fTxtEvtNr = new TGTextEntry(fTop2, fTxtBufEvtNr = new TGTextBuffer(100), 9999 );
+  fTxtEvtNr = new TGTextEntry(fTop2, fTxtBufEvtNr = new TGTextBuffer(100), M_EVTNUMBER);
   fTxtEvtNr->Resize(60, fTxtEvtNr->GetDefaultHeight());
+  fTxtEvtNr->Associate(this) ; 
   fTop2->AddFrame(fTxtEvtNr, new TGLayoutHints(kLHintsTop | kLHintsLeft,
                                                        5, 5, 5, 5)); 
@@ -171,8 +172,10 @@
  
   
-  fButtonPrint = new TGTextButton(fFrameLow, "Print", 9999) ; 
+  fButtonPrint = new TGTextButton(fFrameLow, "Print", M_PRINT) ; 
+  fButtonPrint->Associate(this) ; 
   fFrameLow->AddFrame( fButtonPrint, new TGLayoutHints(kLHintsLeft , 10, 10, 10, 10 ) )  ; 
 
-  fButtonClose = new TGTextButton(fFrameLow, "Close", 9999) ; 
+  fButtonClose = new TGTextButton(fFrameLow, "Close", M_CLOSE) ; 
+  fButtonClose->Associate(this) ; 
   fFrameLow->AddFrame( fButtonClose, new TGLayoutHints(kLHintsLeft, 10, 10, 10, 10 ) )  ; 
 
@@ -210,12 +213,27 @@
 MGFadcDisp::~MGFadcDisp()
 {
+  // close the file 
+
+  readin->PostProcess() ; 
+
+  delete  runheader ; 
+  delete  evtheader ; 
+  delete  evttime   ; 
+  delete  evtdata ; 
+  delete  evtcrate  ; 
+
+  delete  plist ;
+
+  delete  readin ; 
+
+  //   destruct the graphical members  
 
   delete  fButtonPrint ; 
   delete  fButtonClose ; 
-
-  delete  fCan ; 
+ 
+  //  delete  fCan ; 
   delete  fECanDigScope ; 
   delete  fTabDisplay ; 
-
+ 
   delete  fPixSlider ; 
   delete  fButtonPrevPix ; 
@@ -224,9 +242,9 @@
   delete  fPixelList; 
   delete  fTabControl  ; 
-
+ 
   delete  fLabelEvtNr ; 
   delete  fLabelTotNr ; 
+  //delete  fTxtBufEvtNr ; 
   delete  fTxtEvtNr ; 
-  delete  fTxtBufEvtNr ; 
   delete  fButtonNextEvt ; 
   delete  fButtonPrevEvt ; 
@@ -237,5 +255,5 @@
   delete  fTop2 ; 
   delete  fTop1 ; 
-
+  
   delete  fFrameLow ; 
   delete  fLineSep2 ; 
@@ -246,4 +264,15 @@
 
 
+void MGFadcDisp::CloseWindow()
+{
+   // Got close message for this MainFrame. Calls parent CloseWindow()
+   // (which destroys the window) and terminate the application.
+   // The close message is generated by the window manager when its close
+   // window menu item is selected.
+
+  delete this ;
+}
+       
+
 void MGFadcDisp::CreatePixelList() {
   //
@@ -260,6 +289,4 @@
   redraw = fPixelList->GetSelected() ; 
   
-  cout << "redraw: " << redraw << endl ; 
-
   fPixelList->RemoveEntries(0, fPixelsinList) ; 
   fPixelsinList = 0 ; 
@@ -338,4 +365,5 @@
   		 "The event number is out of range!!!",
   		 kMBIconExclamation, buttons, &retval); 
+    UpdateEventCounter() ; 
     return ; 
   }
@@ -364,4 +392,5 @@
   //------------------------------------------------------------------
   char wortdummy[256] ; 
+  Int_t   buttons = 4, retval = 0 ;
 
   switch(GET_MSG(msg)) 
@@ -387,5 +416,18 @@
 
 	      break; 
+
+
+	    case M_PRINT:
+	      new TGMsgBox(fClient->GetRoot(), this,
+			   "INFORMATION!",
+			   "Your are invited to program that!!",
+			   kMBIconExclamation, buttons, &retval); 
 	      
+	      break ; 
+	    case M_CLOSE:
+
+	      CloseWindow() ; 
+	      break; 
+
 	    }
 	  
@@ -410,4 +452,27 @@
 	  
 	}
+    
+    case kC_TEXTENTRY:
+      
+      switch(GET_SUBMSG(msg)) 
+	{
+	case kTE_TEXTCHANGED:
+	  
+	  break ; 
+	case kTE_ENTER:
+	  
+	  sprintf(wortdummy, "%s",  fTxtEvtNr->GetText()) ; 
+	  cout << wortdummy<< endl  ; 
+	  
+	  cout << atoi(wortdummy) << endl ; 
+	  
+	  
+	  ReadinEvent( atoi(wortdummy) ) ; 
+
+	  break; 
+	}
+      
+      break; 
+      
     default:
       break;     
Index: trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h	(revision 586)
+++ trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h	(revision 587)
@@ -34,5 +34,12 @@
   M_PIXELLIST = 4201 , 
   M_PREVEVT, 
-  M_NEXTEVT 
+  M_NEXTEVT,
+  M_EVTNUMBER, 
+
+  M_PREVPIXEL, 
+  M_NEXTPIXEL, 
+
+  M_PRINT, 
+  M_CLOSE 
   
 
@@ -104,4 +111,6 @@
   ~MGFadcDisp()  ; 
 
+  void CloseWindow() ; 
+
   void CreatePixelList() ; 
   void UpdateEventCounter() ; 
