Index: trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
===================================================================
--- trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 12187)
+++ trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 12188)
@@ -167,5 +167,5 @@
         color = float(eventsData[eventNum][i][whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1);
 #else
-        color = float(eventData[nRoi*i + whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1);
+        color = float(eventData[nRoi*hardwareMapping[i] + whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1);
         if (logScale)
         {
@@ -271,6 +271,4 @@
     float plusMe = VALUES_SPAN/2;
 
-    cout << "---> value span..." << endl;
-
     /*
     if (drawCalibrationLoaded)
@@ -281,4 +279,6 @@
         plusMe = 0 ;///=2;
         }*/
+
+    const int hw = hardwareMapping[selectedPixel];
 
     for (int i=0;i<nRoi-1;i++)
@@ -291,6 +291,7 @@
 #else
 
-        float d1 = eventData[nRoi*selectedPixel + i]+plusMe;
-        float d2 = eventData[nRoi*selectedPixel + i+1]+plusMe;
+
+        float d1 = eventData[nRoi*hw + i]+plusMe;
+        float d2 = eventData[nRoi*hw + i+1]+plusMe;
         if (!finite(d1)) d1 = 20000;
         if (!finite(d2)) d2 = 20000;
@@ -1103,5 +1104,5 @@
             for (int i=0;i<nRoi;i++)
             {
-                aMeas[i] = eventData[j*1024+i];// * adcCount;
+                aMeas[i] = eventData[j*nRoi+i];// * adcCount;
 
             }
@@ -1398,24 +1399,38 @@
         timer.start();
 }
-/************************************************************
- * CURRENT SLICE HAS CHANGE. ui handler
- ************************************************************/
-void UIConnector::currentSliceHasChanged(int slice)
+
+void UIConnector::displaySliceValue()
 {
     if (!GLWindow->nRoi)
         return;
-//    str << "Displaying Slice " << slice;
-//    QString qstr(str.str().c_str());
+
+    const int idx =
+        GLWindow->nRoi*GLWindow->hardwareMapping[GLWindow->selectedPixel]
+        + GLWindow->whichSlice;
+
+    ostringstream str;
+    str << "Current Pixel val.: " << GLWindow->eventData[idx];
+    currentPixelValue->setText(QString(str.str().c_str()));
+}
+
+/************************************************************
+ * CURRENT SLICE HAS CHANGE. ui handler
+ ************************************************************/
+void UIConnector::currentSliceHasChanged(int slice)
+{
+    if (!GLWindow->nRoi)
+        return;
+
     if (updateSpinnerDisplay)
         displayingSliceBox->setValue(slice);
 
-    ostringstream str;
-    str << "Current Pixel val.: " << GLWindow->eventData[GLWindow->nRoi*GLWindow->selectedPixel + GLWindow->whichSlice];
-    currentPixelValue->setText(QString(str.str().c_str()));
-
-}
-/************************************************************
+    displaySliceValue();
+}
+
+/*****
+ *******************************************************
  * CURRENT EVENT HAS CHANGED. ui handler
  ************************************************************/
+
 double xval[50000];
 double yval[50000];
@@ -1472,7 +1487,5 @@
     triggerTypeLabel->setText(QString(str.str().c_str()));
 
-    str.str("");
-    str << "Current Pixel val.: " << GLWindow->eventData[GLWindow->nRoi*GLWindow->selectedPixel + GLWindow->whichSlice];
-    currentPixelValue->setText(QString(str.str().c_str()));
+    displaySliceValue();
 
     if (autoScaleColor->isChecked())
@@ -1807,4 +1820,5 @@
     triggerDelayHistoZoom->setZoomStack(stack);
     stack.pop();
+
     pixelChanged(GLWindow->selectedPixel);
 }
@@ -1933,7 +1947,9 @@
 
 }
+
 void UIConnector::pixelChanged(int pixel)
 {
     pixel = GLWindow->hardwareMapping[pixel];
+
     HwIDBox->setValue(pixel);
 
@@ -1970,8 +1986,5 @@
     stack.pop();
 
-    ostringstream str;
-    QString qstr;
-    str << "Current Pixel val.: " << GLWindow->eventData[GLWindow->nRoi*GLWindow->selectedPixel + GLWindow->whichSlice];
-    currentPixelValue->setText(qstr.fromStdString(str.str()));
+    displaySliceValue();
     on_autoScaleColor_clicked();
 }
@@ -1997,8 +2010,8 @@
     updating = false;
 
-    pixelChanged(GLWindow->softwareMapping[hwID]);
-
     GLWindow->selectedPixel = GLWindow->softwareMapping[hwID];
     GLWindow->updateGL();
+
+    pixelChanged(GLWindow->selectedPixel);
 }
 
Index: trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h
===================================================================
--- trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h	(revision 12187)
+++ trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h	(revision 12188)
@@ -248,5 +248,5 @@
     void on_blueValue4_valueChanged(double);
 
-    void pixelChanged(int pixel);
+    void pixelChanged(int);
 
     void cbpxChanged();
@@ -269,4 +269,6 @@
     void on_displayingSliceBox_valueChanged(int);
     void on_displayingEventBox_valueChanged(int);
+
+    void displaySliceValue();
 
     int SetupConfiguration(Configuration &conf);
