Index: trunk/SophyaPI/PI/piapplgen.cc
===================================================================
--- trunk/SophyaPI/PI/piapplgen.cc	(revision 107)
+++ trunk/SophyaPI/PI/piapplgen.cc	(revision 110)
@@ -44,6 +44,6 @@
 // PIMenubar*   Menubar()
 //	Renvoie le pointeur de l'objet "PIMenubar" associé à l'application.
-// void AppendMenu(PIPDMenu *pdm)
-//	Ajoute le "PIPDMenu *pdm" au Menubar de l'application. Le titre 
+// void AppendMenu(PIMenu *pdm)
+//	Ajoute le "PIMenu *pdm" au Menubar de l'application. Le titre 
 //	du menu dans le menubar est le nom de l'objet menu. 
 // void Run() Stop
@@ -68,5 +68,5 @@
 
 
-void PIApplicationGen::AppendMenu(PIPDMenu *pdm)
+void PIApplicationGen::AppendMenu(PIMenu *pdm)
 {
 if (menubar)
Index: trunk/SophyaPI/PI/piapplgen.h
===================================================================
--- trunk/SophyaPI/PI/piapplgen.h	(revision 107)
+++ trunk/SophyaPI/PI/piapplgen.h	(revision 110)
@@ -28,5 +28,5 @@
         virtual PIMenubar*        Menubar() {return menubar;}
 
-        virtual void              AppendMenu(PIPDMenu *pdm);
+        virtual void              AppendMenu(PIMenu *pdm);
 
         virtual void              PrefCompSz(int& szx, int& szy) = 0;
Index: trunk/SophyaPI/PI/piapplx.cc
===================================================================
--- trunk/SophyaPI/PI/piapplx.cc	(revision 107)
+++ trunk/SophyaPI/PI/piapplx.cc	(revision 110)
@@ -99,4 +99,6 @@
 XtAppContext * appctx = PIXtAppCtx(szx, szy);
 
+// Pour appeler FinishCreate() des objets dans la fenetre principale 
+MBCont()->FinishCreate();
 while (mStop)
   {
Index: trunk/SophyaPI/PI/picons.cc
===================================================================
--- trunk/SophyaPI/PI/picons.cc	(revision 107)
+++ trunk/SophyaPI/PI/picons.cc	(revision 110)
@@ -12,5 +12,5 @@
 //  Le menu qui va servir a changer de fontes, couleurs, ...
 // de bouton-3
-static PIPUMenu* opmc=NULL;
+static PIMenu* opmc=NULL;
 static int nb_opmc = 0;
 
@@ -36,4 +36,5 @@
 mCCP = mCLC = 0;
 mDCOff = 0;
+mScb = NULL;
 
 SetMsg(msg);
@@ -71,5 +72,5 @@
 // Pour le menu des options : Fontes, couleur, ...
 if (!opmc) {
-  opmc = new PIPUMenu((PIMsgHandler *)this, "OptCons");
+  opmc = new PIMenu(this, "OptCons", k_PopupMenu);
   opmc->AppendItem("SmallFont", 3101);
   opmc->AppendItem("NormalFont", 3102);
Index: trunk/SophyaPI/PI/picontainerx.cc
===================================================================
--- trunk/SophyaPI/PI/picontainerx.cc	(revision 107)
+++ trunk/SophyaPI/PI/picontainerx.cc	(revision 110)
@@ -26,4 +26,11 @@
 {}
 
+/* --Methode-- */
+void PIContainerX::FinishCreate()
+{
+int k;
+for(k=0; k<mNCh; k++)  mChilds[k]->FinishCreate();
+}
+
 /* --Methode-- 
 void PIContainerX::Show()
Index: trunk/SophyaPI/PI/picontainerx.h
===================================================================
--- trunk/SophyaPI/PI/picontainerx.h	(revision 107)
+++ trunk/SophyaPI/PI/picontainerx.h	(revision 110)
@@ -16,4 +16,6 @@
                            int sx=10, int sy=10, int px=0, int py=0);
 
+  virtual void	 FinishCreate(); // apelle FinishCreate() pour les descendants 
+
   virtual     ~PIContainerX();
 
Index: trunk/SophyaPI/PI/pihisto2d.cc
===================================================================
--- trunk/SophyaPI/PI/pihisto2d.cc	(revision 107)
+++ trunk/SophyaPI/PI/pihisto2d.cc	(revision 110)
@@ -501,27 +501,24 @@
 
 // menus bar
-mPop[0] = new PIPUMenu((PIMsgHandler *)this,"Display");
-mPop[0]->AppendItem("Carres Var."  , 6101);
-mPop[0]->AppendItem("....."        , 6102);
-mPop[0]->AppendItem(".+12..Z*"     , 6103);
-mPop[0]->AppendItem("Carres Pleins", 6104);
-mOPop[0] = new PIOptMenu(this,mPop[0],100,25,10,10);
+mOPop[0] = new PIOptMenu(this, "optmen-h2d-1" ,100,25,10,10);
+mOPop[0]->AppendItem("Carres Var."  , 6101);
+mOPop[0]->AppendItem("....."        , 6102);
+mOPop[0]->AppendItem(".+12..Z*"     , 6103);
+mOPop[0]->AppendItem("Carres Pleins", 6104);
 sdum = "Carres Var."; mOPop[0]->SetValueStr(sdum);
 
-mPop[1] = new PIPUMenu((PIMsgHandler *)this,"Scale");
-mPop[1]->AppendItem("Lineaire", 6201);
-mPop[1]->AppendItem("Log10"   , 6202);
-mOPop[1] = new PIOptMenu(this,mPop[1],100,25,10,40);
+mOPop[1] = new PIOptMenu(this, "optmen-h2d-2", 100,25,10,40);
+mOPop[1]->AppendItem("Lineaire", 6201);
+mOPop[1]->AppendItem("Log10"   , 6202);
 sdum = "Lineaire"; mOPop[1]->SetValueStr(sdum);
 
-mPop[2] = new PIPUMenu((PIMsgHandler *)this,"Color");
-mPop[2]->AppendItem("B&W"      , 6301);
-mPop[2]->AppendItem("Grey32"   , 6302);
-mPop[2]->AppendItem("GreyInv32", 6303);
-mPop[2]->AppendItem("RJ32"     , 6304);
-mPop[2]->AppendItem("BR32"     , 6305);
-mPop[2]->AppendItem("RV32"     , 6306);
-mPop[2]->AppendItem("Arc16"    , 6307);
-mOPop[2] = new PIOptMenu(this,mPop[2],100,25,10,70);
+mOPop[2] = new PIOptMenu(this, "optmen-h2d-3", 100,25,10,70);
+mOPop[2]->AppendItem("B&W"      , 6301);
+mOPop[2]->AppendItem("Grey32"   , 6302);
+mOPop[2]->AppendItem("GreyInv32", 6303);
+mOPop[2]->AppendItem("RJ32"     , 6304);
+mOPop[2]->AppendItem("BR32"     , 6305);
+mOPop[2]->AppendItem("RV32"     , 6306);
+mOPop[2]->AppendItem("Arc16"    , 6307);
 sdum = "B&W"; mOPop[2]->SetValueStr(sdum);
 
@@ -559,5 +556,5 @@
 int i;
 if(dbg) printf("H2WinArg::~H2WinArg %lx\n",(long)this);
-for(i=0;i<3;i++) {delete mPop[i]; delete mOPop[i];}
+for(i=0;i<3;i++) delete mOPop[i];
 for(i=0;i<4;i++) delete mBut[i];
 for(i=0;i<4;i++) delete mLab[i];
Index: trunk/SophyaPI/PI/pihisto2d.h
===================================================================
--- trunk/SophyaPI/PI/pihisto2d.h	(revision 107)
+++ trunk/SophyaPI/PI/pihisto2d.h	(revision 110)
@@ -84,5 +84,4 @@
   PIH2DWdg  * mH2Wdg;
 
-  PIPUMenu  * mPop[3];
   PIOptMenu * mOPop[3];
   PIButton  * mBut[4];
Index: trunk/SophyaPI/PI/pimenubargen.h
===================================================================
--- trunk/SophyaPI/PI/pimenubargen.h	(revision 107)
+++ trunk/SophyaPI/PI/pimenubargen.h	(revision 110)
@@ -14,8 +14,8 @@
 	            ~PIMenubarGen();
 				   
-  virtual void      AppendMenu(PIPDMenu *pdm)=0;
-  virtual void      RemoveMenu(PIPDMenu *pdm)=0;
-  virtual void      SetSensitivity(PIPDMenu *pdm, bool sens=true)=0;
-  virtual bool      IsSensitive(PIPDMenu *pdm)=0;
+  virtual void      AppendMenu(PIMenu *pdm)=0;
+  virtual void      RemoveMenu(PIMenu *pdm)=0;
+  virtual void      SetSensitivity(PIMenu *pdm, bool sens=true)=0;
+  virtual bool      IsSensitive(PIMenu *pdm)=0;
 
   virtual long      kind() {return ClassId; }
Index: trunk/SophyaPI/PI/pimenubarx.cc
===================================================================
--- trunk/SophyaPI/PI/pimenubarx.cc	(revision 107)
+++ trunk/SophyaPI/PI/pimenubarx.cc	(revision 110)
@@ -43,5 +43,5 @@
 
 /* --Methode-- */
-void PIMenubarX::AppendMenu(PIPDMenu *pdm)
+void PIMenubarX::AppendMenu(PIMenu *pdm)
 {
 _pimbxit_ *buto;
@@ -67,5 +67,5 @@
 
 /* --Methode-- */
-void PIMenubarX::RemoveMenu(PIPDMenu *pdm)
+void PIMenubarX::RemoveMenu(PIMenu *pdm)
 {
 int i,j;
@@ -80,5 +80,5 @@
 
 /* --Methode-- */
-void PIMenubarX::SetSensitivity(PIPDMenu *pdm, bool sens)
+void PIMenubarX::SetSensitivity(PIMenu *pdm, bool sens)
 {
 int i;
@@ -93,5 +93,5 @@
 
 /* --Methode-- */
-bool PIMenubarX::IsSensitive(PIPDMenu *pdm)
+bool PIMenubarX::IsSensitive(PIMenu *pdm)
 {
 int i;
Index: trunk/SophyaPI/PI/pimenubarx.h
===================================================================
--- trunk/SophyaPI/PI/pimenubarx.h	(revision 107)
+++ trunk/SophyaPI/PI/pimenubarx.h	(revision 110)
@@ -7,5 +7,5 @@
 {
 SysDWdg itb;
-PIPDMenu *pdm;
+PIMenu *pdm;
 };
 
@@ -15,8 +15,8 @@
 	            ~PIMenubarX();
 
-  virtual void	    AppendMenu(PIPDMenu *pdm);
-  virtual void      RemoveMenu(PIPDMenu *pdm);
-  virtual void      SetSensitivity(PIPDMenu *pdm, bool sens=true);
-  virtual bool      IsSensitive(PIPDMenu *pdm);
+  virtual void	    AppendMenu(PIMenu *pdm);
+  virtual void      RemoveMenu(PIMenu *pdm);
+  virtual void      SetSensitivity(PIMenu *pdm, bool sens=true);
+  virtual bool      IsSensitive(PIMenu *pdm);
 
  protected:
Index: trunk/SophyaPI/PI/pimenugen.cc
===================================================================
--- trunk/SophyaPI/PI/pimenugen.cc	(revision 107)
+++ trunk/SophyaPI/PI/pimenugen.cc	(revision 110)
@@ -1,5 +1,5 @@
 #include "pimenugen.h"
 
-PIMenuGen::PIMenuGen(PIMsgHandler* par, char* nom, PIMenuType pdpu)
+PIMenuGen::PIMenuGen(PIWdg* par, char* nom, PIMenuType pdpu)
 : PIWdg(NULL, nom) , mMTyp(pdpu)
 {
Index: trunk/SophyaPI/PI/pimenugen.h
===================================================================
--- trunk/SophyaPI/PI/pimenugen.h	(revision 107)
+++ trunk/SophyaPI/PI/pimenugen.h	(revision 110)
@@ -5,5 +5,5 @@
 #include PIWDG_H
 
-enum PIMenuType { k_PopupMenu = 1, k_PulldownMenu = 2 };
+enum PIMenuType { k_UTMenu = 0, k_PopupMenu = 1, k_PulldownMenu = 2 };
 
 
@@ -12,5 +12,5 @@
   enum {ClassId = 2500};
 
-	          PIMenuGen(PIMsgHandler* par, char* nom, PIMenuType pdpu);
+	          PIMenuGen(PIWdg* par, char* nom, PIMenuType pdpu=k_UTMenu);
 	          ~PIMenuGen();
 				   
@@ -41,5 +41,4 @@
   virtual void    Show()=0;
   virtual void    Show(PIWdg *w, int px, int py)=0;
-  virtual void    Hide()=0;
 
   virtual long    kind() {return ClassId; }
Index: trunk/SophyaPI/PI/pimenux.cc
===================================================================
--- trunk/SophyaPI/PI/pimenux.cc	(revision 107)
+++ trunk/SophyaPI/PI/pimenux.cc	(revision 110)
@@ -2,5 +2,6 @@
 #include<iostream.h>
 
-#include "pimenux.h"
+#include "pisysdep.h"
+#include PIMENUBAR_H
 
 #include <Xm/Xm.h>
@@ -39,5 +40,5 @@
 pim = (PIMenuX *) (cusd->pmen);
 // pim->Hide();
-pim->Send(cusd->msg, PIMsg_Click );
+pim->SendSelf(cusd->msg, PIMsg_Click );
 #ifdef DEBUG_PIMenuX
 printf("%%%Debug_menu_action: Msg= %d  %lx\n", (int)cusd->msg, (long)pim);
@@ -59,5 +60,5 @@
 if (calld->set == True)  cusd->togstate = toggmenbut = true;
 else  cusd->togstate = toggmenbut = false;
-pim->Send(cusd->msg, PIMsg_DataChanged, (void *)(&toggmenbut));
+pim->SendSelf(cusd->msg, PIMsg_DataChanged, (void *)(&toggmenbut));
 return;
 }
@@ -68,5 +69,5 @@
 
 /* --Methode-- */
-PIMenuX::PIMenuX(PIMsgHandler *par, char *nom, PIMenuType pdpu) 
+PIMenuX::PIMenuX(PIWdg* par, char *nom, PIMenuType pdpu) 
 : PIMenuGen(par, nom, pdpu)
 {
@@ -74,7 +75,16 @@
 mBut = new _pimxit_[mNItemMax];
 
-SysDWdg tw= menuXTopWdg;
-if (tw == NULL) tw = PIXtTopWdg();
-
+SysDWdg tw;
+if (par == NULL) { 
+  tw = menuXTopWdg;
+  if (tw == NULL) tw = PIXtTopWdg(); 
+}
+else  tw = par->XtWdg();
+// Si le type de menu pdpu n'est pas specifie, on le decide 
+// en fonction du type de l'objet parent 
+if (pdpu == k_UTMenu) {
+  if  ( (par->kind() == PIMenu::ClassId) || (par->kind() == PIMenubar::ClassId) )  pdpu = k_PulldownMenu ;
+  else pdpu = k_PopupMenu ;
+}
 if (pdpu == k_PopupMenu)
   XtWdg() = XmCreatePopupMenu( tw, nom, NULL, 0); 
@@ -82,4 +92,5 @@
   XtWdg() = XmCreatePulldownMenu( tw, nom, NULL, 0); 
 
+mMTyp = pdpu;
 wmis = k_wmi_normal ;
 stmng = 0;
@@ -111,5 +122,5 @@
 {
 if (pdm->MType() !=  k_PulldownMenu) {
-  cerr << "PIMenuX::AppendPDMenu()/Erreur: PullDownMenu PIPDMenu seulement ... " << endl;
+  cerr << "PIMenuX::AppendPDMenu()/Erreur: PullDownMenu seulement ... " << endl;
   return;
   }
@@ -238,23 +249,4 @@
 }
 
-
-/* --Methode-- */
-void PIMenuX::Show()
-{
-Manage();
-}
-
-/* --Methode-- */
-void PIMenuX::Show(PIWdg* /*w*/, int /*px*/, int /*py*/)
-{
-Manage();
-}
-
-
-/* --Methode-- */
-void PIMenuX::Hide()
-{
-// UnManage();
-}
 
 
@@ -410,17 +402,12 @@
 
 
-/* --Methode-- */
-PIPUMenuX::PIPUMenuX(PIMsgHandler* par, char* nom)
-: PIMenuX(par, nom, k_PopupMenu)
-{
-}
-
-/* --Methode-- */
-PIPUMenuX::~PIPUMenuX()
-{
-}
-
-void PIPUMenuX::Show()
-{
+
+void PIMenuX::Show()
+{
+if (MType() !=  k_PopupMenu) {
+  cerr << "PIMenuX::Show()/Erreur: PopupMenu seulement ... " << endl;
+  return;
+  }
+
 // XEvent  mevt;
 XButtonEvent evt;
@@ -449,6 +436,10 @@
 
 /* --Methode-- */
-void PIPUMenuX::Show(PIWdg *w, int px, int py)
-{
+void PIMenuX::Show(PIWdg *w, int px, int py)
+{
+if (MType() !=  k_PopupMenu) {
+  cerr << "PIMenuX::Show(w, px, py)/Erreur: PopupMenu seulement ... " << endl;
+  return;
+  }
 // This method should only be used by a button press ...
 int xr, yr;
@@ -483,14 +474,4 @@
 
 
-/* --Methode-- */
-PIPDMenuX::PIPDMenuX(PIMsgHandler* par, char* nom)
-: PIMenuX(par, nom, k_PulldownMenu)
-{
-}
-
-/* --Methode-- */
-PIPDMenuX::~PIPDMenuX()
-{
-}
-
-
+
+
Index: trunk/SophyaPI/PI/pimenux.h
===================================================================
--- trunk/SophyaPI/PI/pimenux.h	(revision 107)
+++ trunk/SophyaPI/PI/pimenux.h	(revision 110)
@@ -20,5 +20,5 @@
 class PIMenuX : public PIMenuGen {
 public:
-	          PIMenuX(PIMsgHandler* par, char* nom, PIMenuType pdpu);
+	          PIMenuX(PIWdg* par, char* nom, PIMenuType pdpu=k_UTMenu);
 	          ~PIMenuX();
 				   
@@ -49,5 +49,5 @@
   virtual void    Show();
   virtual void    Show(PIWdg *w, int px, int py);
-  virtual void    Hide();
+
 
 // Pour usage prive et par OptionMenu, ...
@@ -67,31 +67,6 @@
 };
 
-class PIPUMenuX : public PIMenuX
-{
-public:
-                 PIPUMenuX(PIMsgHandler* par, char* nom);
-                 ~PIPUMenuX();
-
-  virtual void   Show();
-  virtual void   Show(PIWdg *w, int px, int py);
-
-protected:
-     
-};
-
-class PIPDMenuX : public PIMenuX
-{
-public:
-                 PIPDMenuX(PIMsgHandler* par, char* nom);
-                 ~PIPDMenuX();
-
-protected:
-     
-};
 
 typedef PIMenuX        PIMenu;
-typedef PIPUMenuX      PIPUMenu;
-typedef PIPDMenuX      PIPDMenu;
-
 
 
Index: trunk/SophyaPI/PI/pimsghandler.cc
===================================================================
--- trunk/SophyaPI/PI/pimsghandler.cc	(revision 107)
+++ trunk/SophyaPI/PI/pimsghandler.cc	(revision 110)
@@ -69,4 +69,8 @@
 //	optionnel "data" au parent, déclenchant ainsi l'execution
 //	de la méthode "Process(...)" du père.
+// void  SendSelf(PIMessage msg, PIMsgMod mm=0, void* data=NULL)
+//	Envoie le message "msg" avec le modifier "mm", et l'argument 
+//	optionnel "data" à l'objet lui-même, déclenchant ainsi l'execution
+//	de la méthode "Process(...)" de l'objet.
 //--
 
Index: trunk/SophyaPI/PI/pimsghandler.h
===================================================================
--- trunk/SophyaPI/PI/pimsghandler.h	(revision 107)
+++ trunk/SophyaPI/PI/pimsghandler.h	(revision 110)
@@ -47,4 +47,6 @@
 
 	virtual void         Send(PIMessage msg, PIMsgMod mm=0, void* data=NULL);
+	inline  void         SendSelf(PIMessage msg, PIMsgMod mm=0, void* data=NULL)
+                                  { Process(BuildMsg(msg, mm), this, data); }
 
         inline  PIMessage    UserMsg(PIMessage msg) { return (msg >> 8); }
Index: trunk/SophyaPI/PI/pioptmenugen.cc
===================================================================
--- trunk/SophyaPI/PI/pioptmenugen.cc	(revision 107)
+++ trunk/SophyaPI/PI/pioptmenugen.cc	(revision 110)
@@ -2,7 +2,6 @@
 
 
-PIOptMenuGen::PIOptMenuGen(PIContainerGen* par, PIPUMenu *pdm, 
-                         int sx, int sy, int px, int py)
-: PIContainer(par, (char*) pdm->Nom().c_str(), sx, sy, px, py) // Attention au const !
+PIOptMenuGen::PIOptMenuGen(PIContainerGen* par, char* nom, int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py) // Attention au const !
 {
 }
Index: trunk/SophyaPI/PI/pioptmenugen.h
===================================================================
--- trunk/SophyaPI/PI/pioptmenugen.h	(revision 107)
+++ trunk/SophyaPI/PI/pioptmenugen.h	(revision 110)
@@ -4,23 +4,26 @@
 #include <string>
 #include "pisysdep.h"
-#include PICONT_H
 #include PIMENU_H
 
-class PIOptMenuGen : public PIContainer {
+class PIOptMenuGen : public PIWdg {
 public:
   enum {ClassId = 1100};
 
-	             PIOptMenuGen(PIContainerGen* par, PIPUMenu *pdm,
-                                  int sx=10, int sy=10, int px=0, int py=0);
+	             PIOptMenuGen(PIContainerGen* par, char* nom, int sx=50, int sy=15, int px=0, int py=0);
 	             ~PIOptMenuGen();
 				   
   virtual long       kind() {return ClassId; }
 
-  virtual string     GetValueStr() = 0;    // Option choisie
-  virtual PIMessage  GetValue() = 0;       // Message correspondant a l'option choisie
+  inline  PIMenu*    Menu() {return mMen; }     // Renvoie un pointeur sur le menu associe 
+  inline  void       AppendItem(char* nom, PIMessage msg) 
+                                   { mMen->AppendItem(nom, msg); }
+
+  virtual string     GetValueStr() = 0;         // Option choisie
+  virtual PIMessage  GetValue() = 0;            // Message correspondant a l option choisie
   virtual void       SetValueStr(string & s) = 0;
   virtual void       SetValue(PIMessage msg) = 0;
 
 protected:
+  PIMenu* mMen;
 
 };
Index: trunk/SophyaPI/PI/pioptmenux.cc
===================================================================
--- trunk/SophyaPI/PI/pioptmenux.cc	(revision 107)
+++ trunk/SophyaPI/PI/pioptmenux.cc	(revision 110)
@@ -1,30 +1,62 @@
 #include<stdio.h>
+
+#include <Xm/Xm.h>
+#include <Xm/PushB.h>
 
 #include "pisysdep.h"
 #include "pioptmenux.h"
-#include PICONT_H
-#include PISTDWDG_H
+#include "piapplx.h"
 
-#include <Xm/Xm.h>
-#include <Xm/RowColumn.h>
 
 /************* PIOptionMenuX ************/
+static int rsx=0, rsy=0;
+
+/* Nouvelle-Fonction */
+static void mouse_handler_optmenux (Widget wdgp, XtPointer ud, 
+                                    XEvent* evt, Boolean* cont){
+*cont = FALSE ; 
+// printf("---  mouse_handler_optmenux ud = %lx ----- EvtType=%d (%d) \n", (long)ud, evt->type, Expose );
+if ( evt->type == Expose ) {
+  PIOptMenuX* opm = (PIOptMenuX*) ud;
+  Display* dis = PIXDisplay();
+  Window w = XtWindow(opm->XtWdg()) ;
+  XFillRectangle(dis, w, opm->myGC(), rsy, (opm->YSize()-rsy)/2, rsy, rsy); 
+  }
+else if ( (evt->type == ButtonPress) && (evt->xbutton.button == 1))  { 
+  PIXSetLastEventTimeSerial(evt->xbutton.time,  evt->xbutton.serial);
+  PIOptMenuX* opm = (PIOptMenuX*) ud;
+  opm->Menu()->Show(opm, rsy/2, opm->YSize());
+  }
+}
 
 
 /* --Methode-- */
-PIOptMenuX::PIOptMenuX(PIContainerGen* par, PIPUMenu *pum,
-                     int sx, int sy, int px, int py)
-: PIOptMenuGen(par, pum, sx-2, sy-2, px, py)
+PIOptMenuX::PIOptMenuX(PIContainerGen* par, char* nom, int sx, int sy, int px, int py)
+: PIOptMenuGen(par, nom, sx, sy, px, py)
 {
-sx -= 2;
-sy -= 2;
-SetBorderWidth(1); 
-mAB = new PIButton(this, "?", 0, sy-2, sy-2, 1, 1);
-mAB->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_free, PIBK_fixed);
-mAB->ActivatePress(true);
-mLab = new PILabel(this, "OptLabel", sx-sy-1, sy, sy+1, 0);
-mLab->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);
-mMen = pum;
-SetValue(mMen->ItemMsg(0));
+mSmsg = 0;
+mStext = "";
+
+if (rsx == 0) { 
+  PIApplicationPrefCompSize(rsx, rsy);
+  rsy = rsy/3-2; 
+  }
+Arg warg[10];
+int n = 0;
+CreateXtWdg(nom, xmPushButtonWidgetClass, NULL, sx, sy, px, py);
+XtSetArg(warg[n], XmNrecomputeSize, FALSE); n++;
+XtSetArg(warg[n],XmNnavigationType,XmNONE);  n++;
+XtSetArg(warg[n],XmNtraversalOn,FALSE);  n++;
+XtSetArg(warg[n],XmNmarginLeft,rsy*3);  n++;
+XtSetValues(XtWdg(), warg, n);
+XtUninstallTranslations(XtWdg());
+XtAddEventHandler( XtWdg(), ButtonPressMask|ExposureMask, FALSE, mouse_handler_optmenux, this);
+SetBinding(PIBK_fixed, PIBK_fixed, PIBK_free, PIBK_fixed);
+mgc = 0;
+char buff[128];
+strncpy(buff, nom, 64);
+strcat(buff,"_Menu");
+mMen = new PIMenu((PIWdg*)par, buff, k_PopupMenu);
+mMen->SetMsgParent(this);
 Manage();
 }
@@ -34,6 +66,11 @@
 PIOptMenuX::~PIOptMenuX()
 {
-delete mAB;
-delete mLab;
+delete mMen;
+}
+
+/* --Methode-- */
+void PIOptMenuX::FinishCreate()
+{
+if (mSmsg == 0)  SetValue(mMen->ItemMsg(0)); 
 }
 
@@ -42,12 +79,8 @@
 {
 // printf("PIOptMenuX::Process Msg= %d Sender= %lx \n", (int)msg, (long)sender);
-if ((sender == mAB) && (ModMsg(msg) == PIMsg_Press))  
-  {  mMen->SetMsgParent(this);    mMen->Show(this, 0, YSize()); }
-else if (sender == mMen)
-  {
-  mAB->ReleaseButton();
+if (sender == mMen)   {
   SetValue(UserMsg(msg));
-  ReSend(msg, this, data);
-  }
+  ReSend(msg, this, NULL);
+}
 return;
 }
@@ -66,5 +99,7 @@
 mStext = s;
 mSmsg  = mMen->ItemMsg(n);
-mLab->SetLabel(mStext);
+
+SetLabel(mStext);
+
 return;
 }
@@ -82,6 +117,16 @@
 mStext = mMen->ItemName(n);
 mSmsg  = msg;
-mLab->SetLabel(mStext);
+SetLabel(mStext);
 return;
 }
 
+/* --Methode-- */
+void PIOptMenuX::createmygc()
+{
+unsigned long fgc = 0;
+Arg warg[2];
+XtSetArg(warg[0], XmNforeground, &fgc);
+XtGetValues(XtWdg(), warg, 1);
+mgc = XCreateGC(PIXDisplay(), XtWindow(XtWdg()), 0, NULL); 
+XSetForeground(PIXDisplay(), mgc, fgc);
+}
Index: trunk/SophyaPI/PI/pioptmenux.h
===================================================================
--- trunk/SophyaPI/PI/pioptmenux.h	(revision 107)
+++ trunk/SophyaPI/PI/pioptmenux.h	(revision 110)
@@ -8,7 +8,8 @@
 class PIOptMenuX : public PIOptMenuGen {
 public:
-	            PIOptMenuX(PIContainerGen* par, PIPUMenu *pum,  
-                               int sx=10, int sy=10, int px=0, int py=0);
+	            PIOptMenuX(PIContainerGen* par, char* nom, int sx=50, int sy=15, int px=0, int py=0);
 	            ~PIOptMenuX();
+
+  virtual void	    FinishCreate(); 
 
   virtual void      Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
@@ -18,14 +19,14 @@
   virtual void      SetValueStr(string & s);
   virtual void      SetValue(PIMessage msg);
-  
-  
+
+//  Pour utilisation privee dans call-back   
+  inline  GC        myGC() {if (mgc == 0) createmygc();  return(mgc); }  
 
 protected:
-  PIButton *mAB;
-  PILabel  *mLab;
-  PIPUMenu *mMen;
   string   mStext;
   PIMessage mSmsg;
-
+//  SysDWdg mLabel;
+  GC mgc;
+  void              createmygc();
 };
 
Index: trunk/SophyaPI/PI/pistdwdgx.cc
===================================================================
--- trunk/SophyaPI/PI/pistdwdgx.cc	(revision 107)
+++ trunk/SophyaPI/PI/pistdwdgx.cc	(revision 110)
@@ -71,4 +71,5 @@
 pib->myevt.type = pib->myevt.xbutton.type = ButtonRelease;
 pib->myevt.xbutton.serial += 10;
+PIXSetLastEventTimeSerial(calld->event->xbutton.time,  calld->event->xbutton.serial);
 
 return;
Index: trunk/SophyaPI/PI/pitestapp.cc
===================================================================
--- trunk/SophyaPI/PI/pitestapp.cc	(revision 107)
+++ trunk/SophyaPI/PI/pitestapp.cc	(revision 110)
@@ -40,7 +40,6 @@
 	virtual void	Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
 
-//    PIMenubar * menb;
-    PIPDMenu  *m[5];
-    PIPDMenu  *mc[2];
+    PIMenu  *m[5];
+    PIMenu  *mc[2];
     PICheckBox * ckb;
     PIText * text;
@@ -50,7 +49,6 @@
     PILabel * label;
     PIScale * scl;
-    PIPUMenu  * menu;
-    PIPUMenu * pum[2];
-    PIOptMenu * opt, * opt2, *opt3;
+    PIMenu  * menu;
+    PIOptMenu * opt, * opt2;
     PIPixmap * zoom;
     PILabel  * labimg;
@@ -61,27 +59,4 @@
 
 
-/*
-PITestWindow::PITestWindow(PIMsgHandler *par)
-: PIWindow(par, "Peida", PIWK_normal, 200, 200, 50, 50),
-  text(this, "TEXTE", 100, 30, 20,10),
-  label(this, "Label", 100, 20, 20,60),
-  bouton(this, "OK", 66, 40, 20, 20, 100),
-  bouton2(this, "Image", 133, 40, 20, 80, 100),
-  bouton3(this, "Menu", 555, 40, 20, 140, 100),
-  scl(this, "Scale", 88, 5, 45, 100, 20, 10, 130)
-{
-  menu = new PIPUMenu((PIMsgHandler *)this, "myMenu");
-  menu->AppendItem("DoIt-1", 4401);
-  menu->AppendItem("DoIt-2", 4402);
-  menu->AppendItem("DoIt-25", 4425);
-  menu->AppendItem("DoIt-26", 4426);
-  menu->AppendItem("Check-33", 4433);
-  menu->AppendItem("Check-33", 4433);
-
-  label.SetBorderWidth(3);
-  FinishCreate();
-}
-
-*/
 
 PITestApp::PITestApp(int sx, int sy)
@@ -89,6 +64,5 @@
 {
 char ans[128];
-//   menb = new PIMenubar(this, "MyMenubar");
-   m[0] = new PIPDMenu((PIMsgHandler *)Menubar(),"File");
+   m[0] = new PIMenu(Menubar(),"File");
    m[0]->AppendItem("Open", 10101);
    m[0]->AppendItem("Close", 10102);
@@ -96,10 +70,10 @@
    m[0]->AppendItem("ScBar", 10105);
    m[0]->AppendItem("Quit", 10104);
-   m[1] = new PIPDMenu((PIMsgHandler *)Menubar(),"Edit");
+   m[1] = new PIMenu(Menubar(),"Edit");
    m[1]->AppendItem("Copier", 10201);
    m[1]->AppendItem("Coller", 10202);
    m[1]->AppendItem("Couper", 10203);
    m[1]->AppendCheckItem("Check It", 10205);
-   mc[0] = new PIPDMenu(m[1], "Cascade");
+   mc[0] = new PIMenu(m[1], "Cascade");
    mc[0]->AppendItem("EdeCas-1", 10221);
    mc[0]->AppendItem("EdeCas-2", 10222);
@@ -107,14 +81,14 @@
    m[1]->AppendPDMenu(mc[0]);
 
-   m[2] = new PIPDMenu((PIMsgHandler *)Menubar(),"Operation");
+   m[2] = new PIMenu(Menubar(),"Operation");
    m[2]->AppendItem("AddItem", 10301);
    m[2]->AppendItem("DelItemName", 10302);
    m[2]->AppendItem("DelItemMsg", 10303);
 
-   m[3] = new PIPDMenu((PIMsgHandler *)Menubar(),"Special");
+   m[3] = new PIMenu(Menubar(),"Special");
    m[3]->AppendItem("Spec-Opt1", 10401);
    m[3]->AppendItem("Spec-Opt2", 10402);
    m[3]->AppendItem("Spec-Cascade", 10403);
-   mc[1] = new PIPDMenu(m[3], "Spec-Cascade");
+   mc[1] = new PIMenu(m[3], "Spec-Cascade");
    mc[1]->AppendItem("Spec-Cas-1", 10441);
    mc[1]->AppendItem("Spec-Cas-2", 10442);
@@ -123,5 +97,5 @@
    m[3]->AppendCheckItem("Checkable", 10414);
 
-   m[4] = new PIPDMenu((PIMsgHandler *)Menubar(),"AddMenu2");
+   m[4] = new PIMenu(Menubar(),"AddMenu2");
    m[4]->AppendItem("option-A", 10501);
    m[4]->AppendItem("option-B", 10502);
@@ -137,5 +111,5 @@
   label  = new PILabel(this->MainWin(), "Label", 140, 20, 20,80);
   label->SetBorderWidth(1);
-  bouton = new PIButton(this->MainWin(), "OK", 33, 40, 25, 20, 120);
+  bouton = new PIButton(this->MainWin(), "->Menu", 33, 40, 25, 20, 120);
   bouton2 = new PIButton(this->MainWin(), "Image", 133, 40, 25, 80, 120);
   bouton3 = new PIButton(this->MainWin(), "ExDess",  233, 40, 25, 140, 120);
@@ -160,5 +134,5 @@
 //  XSync(PIXDisplay(), FALSE);
 //  printf("Creation PIPUMenu DoIt-1... \n");   gets(ans);
-  menu = new PIPUMenu((PIMsgHandler *)this->MainWin(), "myMenu");
+  menu = new PIMenu(this->MainWin(), "myMenu");
 //  XSync(PIXDisplay(), FALSE);
 //  printf("Apres Creation PIPUMenu -AppendItem() 1 ... \n");   gets(ans);
@@ -176,27 +150,22 @@
 //  XSync(PIXDisplay(), FALSE);
 //  printf("Creation PIPUMenu Copier ... \n");   gets(ans);
-  pum[1] = new PIPUMenu((PIMsgHandler *)this->MainWin(),"Edit");
-  pum[1]->AppendItem("Copier", 80201);
-  pum[1]->AppendItem("Coller", 80202);
-  pum[1]->AppendItem("Couper", 80203);
-  pum[1]->AppendItem("Undo", 80204);
-  pum[1]->AppendItem("Select-All", 80205);
-
-  pum[0] = new PIPUMenu((PIMsgHandler *)this->MainWin(), "myMenu");
-  pum[0]->AppendItem("Linear", 5601);
-  pum[0]->AppendItem("Log.", 5602);
-  pum[0]->AppendItem("Sqrt", 5603);
-  pum[0]->AppendItem("Expon", 5604);
-  pum[0]->AppendItem("Polyn", 5605);
-
-
-  opt = new PIOptMenu(this->MainWin(), pum[0], 90, 25, 110, 150);
+
+
+  opt = new PIOptMenu(this->MainWin(), "Option-Menu-1", 90, 25, 110, 150);
+  opt->AppendItem("Linear", 5601);
+  opt->AppendItem("Log.", 5602);
+  opt->AppendItem("Sqrt", 5603);
+  opt->AppendItem("Expon", 5604);
+  opt->AppendItem("Polyn", 5605);
+
   string ops = "Sqrt";
   opt->SetValueStr(ops);
-  opt2 = new PIOptMenu(this->MainWin(), pum[1], 90, 25, 150, 200);
-
-  opt3 = new PIOptMenu(this->MainWin(), pum[0], 80, 25, 110, 250);
-  ops = "Linear";
-  opt3->SetValueStr(ops);
+
+  opt2 = new PIOptMenu(this->MainWin(), "Option-Menu-1", 90, 25, 150, 200);
+  opt2->AppendItem("Copier", 80201);
+  opt2->AppendItem("Coller", 80202);
+  opt2->AppendItem("Couper", 80203);
+  opt2->AppendItem("Undo", 80204);
+  opt2->AppendItem("Select-All", 80205);
   
 }
@@ -223,6 +192,4 @@
   delete opt;
   delete opt2;
-  delete opt3;
-  delete pum[0];  delete pum[1]; 
   delete zoom;
   delete labimg;
@@ -274,5 +241,5 @@
 
   msg = UserMsg(msg);
-  if (msg == 33) ckb->SetState(true);
+  if (msg == 33) { ckb->SetState(true);  menu->Show(); }
     
   if (msg == 133)
Index: trunk/SophyaPI/PI/piwdgx.h
===================================================================
--- trunk/SophyaPI/PI/piwdgx.h	(revision 107)
+++ trunk/SophyaPI/PI/piwdgx.h	(revision 110)
@@ -90,4 +90,6 @@
 Time PIXGetLastEventTime();
 unsigned long PIXGetLastEventSerial();
+void PIXSetLastEventTimeSerial(Time t, unsigned long ser);
+
 
 #endif/* PIWDGX_SEEN */
Index: trunk/SophyaPI/PI/pixtbase.cc
===================================================================
--- trunk/SophyaPI/PI/pixtbase.cc	(revision 107)
+++ trunk/SophyaPI/PI/pixtbase.cc	(revision 110)
@@ -97,4 +97,5 @@
 
 
+/*  Last XEvent Serial Number and Time-Stamp  */
 static Time last_time_xevt = 0;
 static unsigned long last_serial_xevt = 0;
@@ -102,4 +103,6 @@
 Time PIXGetLastEventTime() { return(last_time_xevt); }
 unsigned long PIXGetLastEventSerial() { return(last_serial_xevt); }
+void PIXSetLastEventTimeSerial(Time t, unsigned long ser) 
+{ last_time_xevt = t;  last_serial_xevt = ser; }
 
 /* Nouvelle-Fonction */
