Index: /trunk/SophyaPI/PI/ex_dessin.cc
===================================================================
--- /trunk/SophyaPI/PI/ex_dessin.cc	(revision 59)
+++ /trunk/SophyaPI/PI/ex_dessin.cc	(revision 60)
@@ -17,8 +17,4 @@
 str[20] = '\0';
 
-ActivateKeyboard();
-ActivateButton(1);
-ActivateButton(2);
-ActivateButton(3);
 }
 
@@ -148,4 +144,5 @@
 buf[0] = key;  buf[1] = '\0';
 
+printf("ExBWdg::Keyboard: Key= %d (%c) , Mod= %d \n", key, (char)key, (int)kmod);
 SelFont(PI_BigSizeFont, PI_BoldFont);
 DrawString(20, 75, buf);
Index: /trunk/SophyaPI/PI/piapplx.cc
===================================================================
--- /trunk/SophyaPI/PI/piapplx.cc	(revision 59)
+++ /trunk/SophyaPI/PI/piapplx.cc	(revision 60)
@@ -9,4 +9,7 @@
 static Cursor a_curs[3];
 static bool a_fgcur=false;
+
+//  Voir fichier pimenux.cc , Pour resoudre certains conflits avec les WindowManagers
+void SetTopWdgForMenuX(SysDWdg mtw);
 
 /* --Methode-- */
@@ -24,4 +27,7 @@
 intcont = new PIContainerX((PIMsgHandler *)this, topwdg, "MBCont", 
                             10, 10, 0, 0);
+// Pb avec les Popup MenuX et certains Window Manager , voir pimenux.cc
+SetTopWdgForMenuX(intcont->XtWdg());
+
 menubar = new PIMenubar(this, "DefMenubar");
 Menubar()->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_free);
Index: /trunk/SophyaPI/PI/pibwdggen.h
===================================================================
--- /trunk/SophyaPI/PI/pibwdggen.h	(revision 59)
+++ /trunk/SophyaPI/PI/pibwdggen.h	(revision 60)
@@ -10,6 +10,12 @@
 #include <list>   
 
+enum PIKeyModifier { PIKM_Blank = 0, PIKM_Shift = 1, PIKM_Alt = 2, PIKM_Cntl = 4 } ; 
 
-enum PIKeyModifier { PIKM_Blank = 0, PIKM_Shift = 1, PIKM_Alt = 2, PIKM_Cntl = 4 } ; 
+enum PIKeyValues { PIK_Return = 1+0x2000, PIK_Enter = 2+0x2000 , 
+                   PIK_BackSpace = 3+0x2000, PIK_Delete = 4+0x2000,
+                   PIK_Tab = 5+0x2000, PIK_Escape = 6+0x2000, 
+                   PIK_Up = 11+0x2000, PIK_Down = 12+0x2000, 
+                   PIK_Right = 13+0x2000, PIK_Left = 14+0x2000,
+                   PIK_Previous = 21+0x2000, PIK_Next = 22+0x2000  } ; 
 
 enum PIColors  { PI_NotDefColor = -1, 
@@ -56,10 +62,4 @@
 
   virtual long       kind() {return ClassId; }
-
-//  Activation des evenements   
-  virtual void       ActivatePtrCross()        = 0;
-  virtual void       ActivateButton(int bid)   = 0;
-  virtual void       ActivateMove(int bid)     = 0;
-  virtual void       ActivateKeyboard()        = 0;
 
 //  Trace graphiques
Index: /trunk/SophyaPI/PI/pibwdgmac.cc
===================================================================
--- /trunk/SophyaPI/PI/pibwdgmac.cc	(revision 59)
+++ /trunk/SophyaPI/PI/pibwdgmac.cc	(revision 60)
@@ -24,27 +24,4 @@
 }
 
-
-/* --Methode-- */
-void PIBaseWdgMac::ActivatePtrCross()
-{
-// toujours actif pour le moment
-}
-
-
-/* --Methode-- */
-void PIBaseWdgMac::ActivateButton(int /*bid*/)
-{
-}
-
-/* --Methode-- */
-void PIBaseWdgMac::ActivateMove(int /*bid*/)
-{
-}
-
-
-/* --Methode-- */
-void PIBaseWdgMac::ActivateKeyboard()
-{
-}
 
 /* --Methode-- */
Index: /trunk/SophyaPI/PI/pibwdgmac.h
===================================================================
--- /trunk/SophyaPI/PI/pibwdgmac.h	(revision 59)
+++ /trunk/SophyaPI/PI/pibwdgmac.h	(revision 60)
@@ -17,10 +17,4 @@
                                    int sx=10, int sy=10, int px=0, int py=0);
   virtual           ~PIBaseWdgMac();
-
-//  Activation des evenements   
-  virtual void       ActivatePtrCross();
-  virtual void       ActivateButton(int bid);
-  virtual void       ActivateMove(int bid);
-  virtual void       ActivateKeyboard();
 
 //  Trace graphiques
Index: /trunk/SophyaPI/PI/pibwdgx.cc
===================================================================
--- /trunk/SophyaPI/PI/pibwdgx.cc	(revision 59)
+++ /trunk/SophyaPI/PI/pibwdgx.cc	(revision 60)
@@ -48,4 +48,6 @@
 XtSetArg(wargs[2],XtNborderWidth, (Dimension)0);  
 XtSetValues(XtWdg(), wargs, 3);
+
+XtUninstallTranslations(XtWdg());
 
 mDefGC = XCreateGC (PIXDisplay(), XtWindow(PIXtTopWdg()), 0, NULL);
@@ -63,4 +65,12 @@
 SelMarker(1, PI_DotMarker);
 
+// On active tous les evenements ...
+ActivatePtrCross();
+ActivateKeyboard();
+int i;
+for(i=1; i<=3; i++) {
+  ActivateButton(i);
+  ActivateMove(i); 
+} 
 Manage();
 }
Index: /trunk/SophyaPI/PI/pibwdgx.h
===================================================================
--- /trunk/SophyaPI/PI/pibwdgx.h	(revision 59)
+++ /trunk/SophyaPI/PI/pibwdgx.h	(revision 60)
@@ -17,10 +17,4 @@
 
   virtual void    FinishCreate(); // appele par la fenetre mere, apres XtRealize()
-
-//  Activation des evenements   
-  virtual void   ActivatePtrCross();
-  virtual void   ActivateButton(int bid);
-  virtual void   ActivateMove(int bid);
-  virtual void   ActivateKeyboard();
 
 //  Trace graphiques
@@ -98,4 +92,9 @@
   void           Init();
   void           SelectFont(int isz, int jat);
+//  Activation des evenements   
+  void   ActivatePtrCross();
+  void   ActivateButton(int bid);
+  void   ActivateMove(int bid);
+  void   ActivateKeyboard();
 
   GC mDefGC;
Index: /trunk/SophyaPI/PI/picontainerx.cc
===================================================================
--- /trunk/SophyaPI/PI/picontainerx.cc	(revision 59)
+++ /trunk/SophyaPI/PI/picontainerx.cc	(revision 60)
@@ -8,5 +8,5 @@
 : PIContainerGen(par, nom, sx, sy, px, py)
 {
-if ((sx > 0) && (sy > 0))
+if ((sx > 0) && (sy > 0)) 
   CreateXtWdg(nom, xmFormWidgetClass , NULL, sx, sy, px, py);
 //  CreateXtWdg(nom, xmBulletinBoardWidgetClass , NULL, sx, sy, px, py);
@@ -18,5 +18,5 @@
 {
 SetMsgParent(par);
-if ((sx > 0) && (sy > 0))
+if ((sx > 0) && (sy > 0)) 
   CreateXtWdg(nom, xmFormWidgetClass , parwdg->XtWdg(), sx, sy, px, py);
 }
Index: /trunk/SophyaPI/PI/piimage.cc
===================================================================
--- /trunk/SophyaPI/PI/piimage.cc	(revision 59)
+++ /trunk/SophyaPI/PI/piimage.cc	(revision 60)
@@ -52,11 +52,4 @@
 SelForeground(PI_White);
 SelBackground(PI_Black);
-
-ActivateButton(1);
-ActivateMove(1);
-ActivateButton(2);
-ActivateMove(2);
-ActivateButton(3);
-ActivateMove(3);
 
 }
Index: /trunk/SophyaPI/PI/pimenux.cc
===================================================================
--- /trunk/SophyaPI/PI/pimenux.cc	(revision 59)
+++ /trunk/SophyaPI/PI/pimenux.cc	(revision 60)
@@ -11,6 +11,17 @@
 /************* PIMenuX ************/
 
+// Quand on cree les menus comme fils du Top-Widget, ca rentre en 
+// conflit avec certaains Window-Manager ...
+// La fonction suivante permet de bypasser ce probleme- Le createur d'application
+// X doit donc appeler la fonction ci-dessous pour initialiser menuXTopWdg
+//                                               Reza /411/97
+static SysDWdg menuXTopWdg = NULL;
+void SetTopWdgForMenuX(SysDWdg mtw) {
+  menuXTopWdg = mtw;
+}
+
 // Pour ces sal... de XmString  (ds piwdgx.cc)
 int CStrFrXmStr(XmString xms, char* buff, int nmx);
+
 
 // Fonction prive (CallBack)
@@ -43,8 +54,11 @@
 mBut = new _pimxit_[mNItemMax];
 
+SysDWdg tw= menuXTopWdg;
+if (tw == NULL) tw = PIXtTopWdg();
+
 if (pdpu == k_PopupMenu)
-  XtWdg() = XmCreatePopupMenu( PIXtTopWdg(), nom, NULL, 0); 
+  XtWdg() = XmCreatePopupMenu( tw, nom, NULL, 0); 
 else 
-  XtWdg() = XmCreatePulldownMenu( PIXtTopWdg(), nom, NULL, 0); 
+  XtWdg() = XmCreatePulldownMenu( tw, nom, NULL, 0); 
 
 wmis = k_wmi_normal ;
Index: /trunk/SophyaPI/PI/pipixmapgen.cc
===================================================================
--- /trunk/SophyaPI/PI/pipixmapgen.cc	(revision 59)
+++ /trunk/SophyaPI/PI/pipixmapgen.cc	(revision 60)
@@ -22,5 +22,4 @@
 cmap = new PIColorMap(CMAP_GREY32);
 mEn = 0;
-ActivateButton(1);
 }
 
Index: /trunk/SophyaPI/PI/piscdrawwdg.cc
===================================================================
--- /trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 59)
+++ /trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 60)
@@ -18,9 +18,4 @@
   mTrW = NULL;
   SetTextWin(NULL);
-
-  ActivateButton(1);    // Pour pouvoir activer la fenetre et coordonnees 
-  ActivateMove(1);      //    "         "         "        "
-  ActivateButton(2);
-  ActivateMove(2);
 
 }
Index: /trunk/SophyaPI/PI/pitestapp.cc
===================================================================
--- /trunk/SophyaPI/PI/pitestapp.cc	(revision 59)
+++ /trunk/SophyaPI/PI/pitestapp.cc	(revision 60)
@@ -20,5 +20,9 @@
 #include "piimage.h"
 
+#include PILIST_H
+
 #include "fitsimage.h"
+
+#include <X11/Xlib.h>
 
 int SysBeep(int n)
@@ -95,4 +99,5 @@
 : PIApplication(sx, sy)
 {
+char ans[128];
 //   menb = new PIMenubar(this, "MyMenubar");
    m[0] = new PIPDMenu((PIMsgHandler *)Menubar(),"File");
@@ -100,4 +105,5 @@
    m[0]->AppendItem("Close", 10102);
    m[0]->AppendItem("New", 10103);
+   m[0]->AppendItem("ScBar", 10105);
    m[0]->AppendItem("Quit", 10104);
    m[1] = new PIPDMenu((PIMsgHandler *)Menubar(),"Edit");
@@ -124,11 +130,19 @@
   bouton4 = new PIButton(this->MainWin(), "Dialog", 333, 40, 25, 200, 120);
   bouton5 = new PIButton(this->MainWin(), "ScDraw", 433, 40, 25, 260, 120);
-  scl = new PIScale(this->MainWin(), "Scale", 88, 5, 45, 100, 20, 10, 150);
-
+  scl = new PIScale(this->MainWin(), "Scale", 88, true, 100, 20, 10, 150);
+  scl->SetMinMax(5, 45);
   zoom = new PIPixmap(this->MainWin(), "Zoom", 100,100,5,195);
   labimg = new PILabel(this->MainWin(), "PixelValue", 250, 20, 10, 320);
 
-  menu = new PIPUMenu((PIMsgHandler *)this, "myMenu");
+//  XSync(PIXDisplay(), FALSE);
+//  printf("Creation PIPUMenu DoIt-1... \n");   gets(ans);
+  menu = new PIPUMenu((PIMsgHandler *)this->MainWin(), "myMenu");
+//  XSync(PIXDisplay(), FALSE);
+//  printf("Apres Creation PIPUMenu -AppendItem() 1 ... \n");   gets(ans);
+
   menu->AppendItem("DoIt-1", 4401);
+//  XSync(PIXDisplay(), FALSE);
+//  printf("Apres Creation PIPUMenu -AppendItem() 2 ... \n");   gets(ans);
+
   menu->AppendItem("DoIt-2", 4402);
   menu->AppendItem("DoIt-25", 4425);
@@ -137,5 +151,7 @@
   menu->AppendItem("Check-33", 4433);
 
-  pum[1] = new PIPUMenu((PIMsgHandler *)this,"Edit");
+//  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);
@@ -144,5 +160,5 @@
   pum[1]->AppendItem("Select-All", 80205);
 
-  pum[0] = new PIPUMenu((PIMsgHandler *)this, "myMenu");
+  pum[0] = new PIPUMenu((PIMsgHandler *)this->MainWin(), "myMenu");
   pum[0]->AppendItem("Linear", 5601);
   pum[0]->AppendItem("Log.", 5602);
@@ -151,4 +167,5 @@
   pum[0]->AppendItem("Polyn", 5605);
 
+
   opt = new PIOptMenu(this->MainWin(), pum[0], 90, 25, 110, 150);
   opt->SetValueStr("Sqrt");
@@ -157,5 +174,5 @@
   opt3 = new PIOptMenu(this->MainWin(), pum[0], 80, 25, 110, 250);
   opt3->SetValueStr("Linear");
-
+  
 }
 
@@ -188,7 +205,8 @@
 static PIImage *cur=NULL;
 static ScSample *scs1, *scs2, *scs3;
+static PIScrollBar *scb, *scb2;
 static ExBWdg *exb1;
 
-static PIWindow * wp3, *wp2, *wp4, *wp5;
+static PIWindow * wp3, *wp2, *wp4, *wp5, *wp6;
 static PIPixmap * pxm;
 static unsigned char  pixels[25000];
@@ -198,4 +216,6 @@
 static bool  fgt2 = false;
 
+static PIListX * pil;
+
 void
 PITestApp::Process(PIMessage msg, PIMsgHandler* sender, void* data)
@@ -208,6 +228,6 @@
   sprintf(truc,"< %ld - %d (%d)>",msg,x++, (int)((PIWdgGen *)sender)->kind());
   this->label->SetLabel(truc);
-  sprintf(truc,"[%d] Msg= %ld (%d-%d) Kind=(%d)",x, msg, (int)UserMsg(msg),
-         (int)ModMsg(msg), (int)((PIWdgGen *)sender)->kind());
+  sprintf(truc,"[%d] Msg= %ld (%d-%d) Kind=(%d)  Data= (%d - %lx)",x, msg, (int)UserMsg(msg),
+         (int)ModMsg(msg), (int)((PIWdgGen *)sender)->kind(), (int)data, (long)data);
   puts(truc);
 
@@ -252,10 +272,11 @@
   if (msg == 433)
     {
-    if (fgt2) { wp5->Hide();  fgt2 = false; }
-    else { wp5->Show();  fgt2 = true; }
+    if (fgt2) { wp5->Hide();  wp6->Hide(); fgt2 = false; }
+    else { wp5->Show();  wp6->Show(); fgt2 = true; }
     }
 
 //  if (msg == 555)   (this->menu)->Show(); 
 
+  if (msg == 10105)  scb->SetSize(atoi(((char *)text->GetText().c_str())));
   if (msg == 10104)  Stop();
   if (msg == 10101)  { pfc->AcceptNewFile(false); pfc->Show(); }
@@ -265,5 +286,7 @@
    { 
    numsg++;    
-   m[1]->AppendItem((char *)text->GetText().c_str(), numsg); 
+   string nit;
+   nit = text->GetText();
+   m[1]->AppendItem((char *)nit.c_str(), numsg); 
    opt2->SetValue(numsg);
    }
@@ -272,5 +295,7 @@
   if (msg == 10303)  
     {
-    long ml =  atol(text->GetText().c_str());
+    string nit;
+    nit = text->GetText();
+    long ml =  atol(nit.c_str());
     m[1]->DeleteItemMsg(ml);
     opt2->SetValue(10201);
@@ -278,5 +303,5 @@
 
 
-  if ((msg > 8000) && data) printf("PITestApp::MenubarReturn: %s \n", (char *)data);
+  if ((msg > 9000) && data) printf("PITestApp::MenubarReturn: %s \n", (char *)data);
   if (msg == 5000)  
     { 
@@ -306,15 +331,14 @@
 }
 
-int main()
-{
+int main(int narg, char *arg[])
+{
+  int mii;
+
   PITestApp * app;
   app = new PITestApp(350, 350);
 
-  wp2 = new PIWindow(app, "Window-2", PIWK_normal,  150, 150, 250, 250);
-  ExBWdg bw(wp2, "BWdg", 150, 150, 0, 0);
-//  bw.ActivateButton(1);
-//  bw.ActivatePtrCross();
-//  bw.ActivateKeyboard();
-
+  wp2 = new PIWindow(app, "Window-2", PIWK_normal,  200, 200, 250, 250);
+  ExBWdg bw(wp2, "BWdg", 150, 150, 10, 40);
+  bw.SetBinding(PIBK_fixed,PIBK_elastic,PIBK_elastic,PIBK_fixed);
 
   wp4 = new PIWindow(app, "Window-4", PIWK_dialog,  200, 200, 350, 350);
@@ -340,12 +364,22 @@
   pxm->SetPixmap(pixels, 150, 150);
 
-  wp5 = new PIWindow(app, "Window-5", PIWK_normal,  400, 450, 200, 200);
+  wp5 = new PIWindow(app, "Window-5", PIWK_normal,  420, 450, 200, 200);
   scs1 = new ScSample(wp5, "ScSample", 200, 200, 0, 0);
   scs1->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
   scs2 = new ScSample(wp5, "ScSample", 160, 160, 220, 20);
-  scs2->SetBinding(PIBK_elastic,PIBK_fixed,PIBK_fixed,PIBK_elastic);
+  printf("DBG-WP5 (A) , SCS2, SzC %d %d , Sz %d %d Pos %d %d \n", wp5->XSize(),
+         wp5->YSize(), scs2->XSize(), scs2->YSize(),scs2->XPos(), scs2->YPos() ); 
+//  scs2->SetBinding(PIBK_elastic,PIBK_fixed,PIBK_fixed,PIBK_elastic);
+  scs2->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  printf("DBG-WP5 (B) , SCS2, SzC %d %d , Sz %d %d Pos %d %d \n", wp5->XSize(),
+         wp5->YSize(), scs2->XSize(), scs2->YSize(),scs2->XPos(), scs2->YPos() ); 
+
+  scb = new PIScrollBar(wp5, "ScBar", 8811, true, 15, 420, 405, 0);
+  scb->SetBinding(PIBK_free,PIBK_fixed,PIBK_fixed,PIBK_fixed);
+  scb->ActivateDrag(true);
+  scb2 = new PIScrollBar(wp5, "ScBar", 8821, false, 420, 15, 0, 425);
+  scb2->SetBinding(PIBK_fixed,PIBK_free,PIBK_fixed,PIBK_fixed);
 
   scs3 = new ScSample(wp5, "ScSample", 200, 200, 100, 220);
-
   scs3->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
   /*  
@@ -358,5 +392,15 @@
   pfc->SetPath("/exp/eros/ImagRed/");
 
-
+  wp6 = new PIWindow(app, "Window-List", PIWK_normal,  200, 250, 300, 400);
+  pil = new PIListX(wp6, "MyList", 200, 250, 0, 0);
+  pil->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed,PIBK_fixed);
+  for(mii=1; mii<narg; mii++)
+    {
+    printf("AppendItem[%d] - %s (%ld) \n", mii, arg[mii],  3330+mii);  
+     pil->AppendItem(arg[mii], 3330+mii);  
+    puts("Append-OK");
+    }
+  pil->SetMultipleSelect(true);
+  pil->SelectItem("user.cc");
 //  Int32 ioNumber = 100;
   app->Run();
Index: /trunk/SophyaPI/PI/piup.h
===================================================================
--- /trunk/SophyaPI/PI/piup.h	(revision 59)
+++ /trunk/SophyaPI/PI/piup.h	(revision 60)
@@ -1,4 +1,4 @@
 #include "cimage.h"
-
+extern "C" {
 RzImage * PIUserProc_1(ImageR4& myimg, int xp, int yp, int dx, int dy,
                        char * arg1, char * arg2);
@@ -7,2 +7,4 @@
 RzImage * PIUserProc_3(ImageR4& myimg, int xp, int yp, int dx, int dy, 
                        char * arg1, char * arg2);
+}
+
Index: /trunk/SophyaPI/PI/piwdgx.cc
===================================================================
--- /trunk/SophyaPI/PI/piwdgx.cc	(revision 59)
+++ /trunk/SophyaPI/PI/piwdgx.cc	(revision 60)
@@ -244,32 +244,33 @@
                         PIBindingKind right, PIBindingKind bottom)
 {
-Arg  wargs[3];
+Arg  wargs[9];
 int n=0;
 if (!sdw)  return;
 if (!parent)  return;
 
-/*
+int fbase = 1000 ;  // Valeur de XmNfractionBase des XmForm ds PIContainerX
+int frpos = 0;
+float frac;
+
 n = 0;
-XtSetArg(wargs[n],XmNfractionBase, 500);  n++;
-XtSetValues(this->sdw, wargs, n);
-*/
+XtSetArg(wargs[n],XmNfractionBase, fbase);  n++;
+XtSetValues(parent->XtWdg(), wargs, n);
+
+// printf(" DEBUG_SetBinding: C-Sz= %d %d - Sz=%d %d , Pos= %d %d \n",  parent->XSize(),
+// parent->YSize(), XSize(), YSize(), XPos(), YPos());
 switch (left)
   {
   case PIBK_free : 
-    n = 0;
     XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_NONE);  n++;
-    XtSetValues(this->sdw, wargs, n);
     break;
   case PIBK_fixed :
-    n = 0;
     XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_FORM);  n++;
     XtSetArg(wargs[n],XmNleftOffset, XPos() );  n++;
-    XtSetValues(this->sdw, wargs, n);
     break;
   case PIBK_elastic :
-    n = 0;
     XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_POSITION);  n++;
-    XtSetArg(wargs[n],XmNleftPosition, (XPos()*100/parent->XSize()) );  n++;
-    XtSetValues(this->sdw, wargs, n);
+    frac = (float)(XPos())/(float)parent->XSize() ;
+    frpos = frac*fbase;
+    XtSetArg(wargs[n],XmNleftPosition, frpos );  n++;
     break;
   }
@@ -278,19 +279,15 @@
   {
   case PIBK_free : 
-    n = 0;
     XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_NONE);  n++;
-    XtSetValues(this->sdw, wargs, n);
     break;
   case PIBK_fixed :
-    n = 0;
     XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_FORM);  n++;
     XtSetArg(wargs[n],XmNtopOffset, YPos() );  n++;
-    XtSetValues(this->sdw, wargs, n);
     break;
   case PIBK_elastic :
-    n = 0;
     XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_POSITION);  n++;
-    XtSetArg(wargs[n],XmNtopPosition, (YPos()*100/parent->YSize()) );  n++;
-    XtSetValues(this->sdw, wargs, n);
+    frac = (float)(YPos())/(float)parent->YSize() ;
+    frpos = frac*fbase;
+    XtSetArg(wargs[n],XmNtopPosition, frpos );  n++;
     break;
   }
@@ -299,19 +296,15 @@
   {
   case PIBK_free : 
-    n = 0;
     XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_NONE);  n++;
-    XtSetValues(this->sdw, wargs, n);
     break;
   case PIBK_fixed :
-    n = 0;
     XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_FORM);  n++;
     XtSetArg(wargs[n],XmNrightOffset, parent->XSize()-(XSize()+XPos()) );  n++;
-    XtSetValues(this->sdw, wargs, n);
     break;
   case PIBK_elastic :
-    n = 0;
     XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_POSITION);  n++;
-    XtSetArg(wargs[n],XmNrightPosition, ((XPos()+XSize())*100/parent->XSize()) );  n++;
-    XtSetValues(this->sdw, wargs, n);
+    frac = (float)(XPos()+XSize())/(float)parent->XSize() ;
+    frpos = frac*fbase;
+    XtSetArg(wargs[n],XmNrightPosition, frpos );  n++;
     break;
   }
@@ -320,21 +313,22 @@
   {
   case PIBK_free : 
-    n = 0;
     XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_NONE);  n++;
-    XtSetValues(this->sdw, wargs, n);
     break;
   case PIBK_fixed :
-    n = 0;
     XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_FORM);  n++;
     XtSetArg(wargs[n],XmNbottomOffset, parent->YSize()-(YSize()+YPos()) );  n++;
-    XtSetValues(this->sdw, wargs, n);
     break;
   case PIBK_elastic :
-    n = 0;
     XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_POSITION);  n++;
-    XtSetArg(wargs[n],XmNbottomPosition, ((YPos()+YSize())*100/parent->YSize()) );  n++;
-    XtSetValues(this->sdw, wargs, n);
-    break;
-  }
+    frac = (float)(YPos()+YSize())/(float)parent->YSize() ;
+    frpos = frac*fbase;
+    XtSetArg(wargs[n],XmNbottomPosition, frpos );  n++;
+    break;
+  }
+
+XtSetValues(this->sdw, wargs, n);
+
+// printf(" Out_SetBinding: C-Sz= %d %d - Sz=%d %d , Pos= %d %d \n",  parent->XSize(),
+// parent->YSize(), XSize(), YSize(), XPos(), YPos());
 
 return;
Index: /trunk/SophyaPI/PI/pixtbase.cc
===================================================================
--- /trunk/SophyaPI/PI/pixtbase.cc	(revision 59)
+++ /trunk/SophyaPI/PI/pixtbase.cc	(revision 60)
@@ -6,4 +6,6 @@
 #include <X11/IntrinsicP.h>
 #include <X11/CoreP.h>
+
+#include <X11/keysym.h>
 
 #include "pixtbaseP.h"
@@ -356,4 +358,5 @@
 last_time_xevt = evt->xkey.time;
 last_serial_xevt = evt->xkey.serial;
+
 if (((PIXtBaseWidget)wdgp)->pixtbase.objet)  
   {
@@ -361,20 +364,49 @@
   KeySym key;
   char buf[10];
-  int i,nc;
+  int i,nc,rkey;
   PIKeyModifier kmod;
   
   kmod = PIKM_Blank;
-
   nc = XLookupString(&(evt->xkey), buf, 10, &key, &cs);
-  if (nc <= 0)  return;
+
   if  (evt->xkey.state & ShiftMask)   
     kmod = (PIKeyModifier) (kmod | PIKM_Shift);
   if  (evt->xkey.state & ControlMask) 
     kmod = (PIKeyModifier) (kmod | PIKM_Cntl);
-  if  (evt->xkey.state & Mod2Mask)    
+  if  (evt->xkey.state & Mod1Mask)    
     kmod = (PIKeyModifier) (kmod | PIKM_Alt);
-  for(i=0; i<nc; i++)  
+  switch (key) {
+    case XK_Return :
+      rkey = PIK_Return;
+      break;
+    case XK_KP_Enter :
+      rkey = PIK_Enter;
+      break;
+    case XK_Up :
+      rkey = PIK_Up;
+      break;
+    case XK_Down :
+      rkey = PIK_Down;
+      break;
+    case XK_Left :
+      rkey = PIK_Left;
+      break;
+    case XK_Right :
+      rkey = PIK_Right;
+      break;
+    case XK_Prior :
+      rkey = PIK_Previous;
+      break;
+    case XK_Next :
+      rkey = PIK_Next;
+      break;
+    default :
+      rkey = 0;
+      break;
+  }
+  if (rkey > 0)  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Keyboard(rkey, kmod);
+  else for(i=0; i<nc; i++)  
     (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Keyboard((int)(buf[i]), kmod);
-  }
+}
 return;
 }
