ecere: Clang warning fixes
[sdk] / ecere / src / gui / controls / ListBox.ec
index 6f609dd..96c7582 100644 (file)
@@ -52,8 +52,9 @@ extern int __ecereVMethodID_class_OnSaveEdit;
 
 private:
 
-public class DataField 
+public class DataField
 {
+   class_no_expansion;
 public:
    property Class dataType
    {
@@ -119,7 +120,7 @@ public:
       }
    };
    property int sortOrder { get { return this ? sortOrder : 0; } };
-   property char * header
+   property const char * header
    {
       set
       {
@@ -133,7 +134,7 @@ public:
       set
       {
          userData = value;
-      } 
+      }
       get
       {
          return this ? userData : null;
@@ -141,7 +142,7 @@ public:
    };
    property bool freeData
    {
-      set { freeData = value; } get { return freeData; }      
+      set { freeData = value; } get { return freeData; }
    };
    property DataField prev { get { return prev; } };
    property DataField next { get { return next; } };
@@ -150,9 +151,6 @@ public:
    {
       if(prev != after)
       {
-         int position = 0;
-         DataField field;
-
          listBox.fields.Move(this, after);
 
          // Fix up positions
@@ -181,12 +179,12 @@ public:
             if(cell && cell.isSet && dataType)
             {
                static char tempString[4096];
-               String string;
+               const String string;
                int tw = 0;
                if(dataType.type == normalClass || dataType.type == noHeadClass)
-                  string = ((char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, cell.data[0], tempString, userData, null);
+                  string = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, cell.data[0], tempString, userData, null);
                else
-                  string = ((char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, cell.data, tempString, userData, null);
+                  string = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, cell.data, tempString, userData, null);
                if(string)
                   display.FontExtent(row.header ? boldFont : font, string, strlen(string), &tw, null);
                else
@@ -223,11 +221,11 @@ private:
          listBox.fields.Remove(this);
          for(field = listBox.fields.first; field; field = field.next)
          {
-            if(field.index >= index) 
+            if(field.index >= index)
                field.index--;
          }
          if(listBox.currentField == this)
-            listBox.currentField = null;            
+            listBox.currentField = null;
          listBox.numFields--;
          listBox.OnResize(listBox.clientSize.w, listBox.clientSize.h);
          listBox = null;
@@ -235,7 +233,7 @@ private:
    }
 
    DataField prev, next;
-   char * header;
+   const char * header;
    Class dataType;
    int width;
    uint index;
@@ -258,28 +256,28 @@ public class DataRow
    bool skipCheck;
 #endif
 public:
-   property int64 tag { set { tag = value; } get { return tag; } };
+   property int64 tag { set { if(this) tag = value; } get { return this ? tag : 0; } };
    property DataRow previous { get { return prev; } };
    property DataRow next { get { return next; } };
    property int index { get { return (this && (!parent || parent.IsExpanded())) ? index : -1; } };
-   property char * string
+   property const char * string
    {
       set { SetData(listBox.fields.first, value); }
       get { return GetData(listBox.fields.first); }
    };
    property bool isHeader { set { header = value; } get { return this ? header : false; } };
-   property BitmapResource icon { set { icon = value; } get { return icon; } };
+   property BitmapResource icon { set { if(this) icon = value; } get { return this ? icon : null; } };
    property bool collapsed
    {
       set
       {
-         if(collapsed != value)
+         if(this && collapsed != value)
          {
             collapsed = value;
             if(parent.IsExpanded())
             {
                DataRow search;
-               int index;
+               int ix;
 
                if(value)
                {
@@ -292,11 +290,11 @@ public:
                      if(!listBox.clickedRow)
                         listBox.clickedRow = this;
                   }
-                  if(listBox.currentRow && !listBox.currentRow.parent.IsExpanded()) 
+                  if(listBox.currentRow && !listBox.currentRow.parent.IsExpanded())
                   {
                      listBox.SetCurrentRow(this, true);
                   }
-                  if(listBox.firstRowShown && !listBox.firstRowShown.parent.IsExpanded()) 
+                  if(listBox.firstRowShown && !listBox.firstRowShown.parent.IsExpanded())
                   {
                      listBox.firstRowShown = GetPrevRow();
                      if(!listBox.firstRowShown)
@@ -304,16 +302,16 @@ public:
                   }
                }
 
-               index = this.index+1;
+               ix = index+1;
                for(search = GetNextRow(); search; search = search.GetNextRow())
-                  search.index = index++;
-               listBox.rowCount = index;
+                  search.index = ix++;
+               listBox.rowCount = ix;
 
                listBox.HideEditBox(false, false, true);
 
                listBox.SetScrollArea(
                   listBox.width,
-                  (listBox.rowCount * listBox.rowHeight) + 
+                  (listBox.rowCount * listBox.rowHeight) +
                   ((listBox.style.header) ? listBox.rowHeight : 0) -
                   ((!((listBox.clientSize.h+1) % listBox.rowHeight)) ? listBox.rowHeight : 0), true);
                listBox.Update(null);
@@ -321,7 +319,7 @@ public:
             }
          }
 #ifdef _DEBUG
-         if(!skipCheck)
+         if(this && !skipCheck)
             listBox.CheckConsistency();
 #endif
       }
@@ -358,14 +356,14 @@ public:
             listBox.HideEditBox(false, false, true);
 
             /*
-            if(this == listBox.clickedRow) 
+            if(this == listBox.clickedRow)
             {
                listBox.clickedRow = GetNextRow();
                if(!listBox.clickedRow)
                   listBox.clickedRow = GetPrevRow();
             }
 
-            if(this == listBox.currentRow) 
+            if(this == listBox.currentRow)
             {
                DataRow newCurrentRow = GetNextRow();
                if(!listBox.newCurrentRow)
@@ -373,7 +371,7 @@ public:
                listBox.SetCurrentRow(newCurrentRow, true);
             }
 
-            if(this == listBox.firstRowShown) 
+            if(this == listBox.firstRowShown)
             {
                listBox.firstRowShown = GetPrevRow();
                if(!listBox.firstRowShown)
@@ -423,7 +421,7 @@ public:
 
                listBox.SetScrollArea(
                   listBox.width,
-                  (listBox.rowCount * listBox.rowHeight) + 
+                  (listBox.rowCount * listBox.rowHeight) +
                   ((listBox.style.header) ? listBox.rowHeight : 0) -
                   ((!((listBox.clientSize.h+1) % listBox.rowHeight)) ? listBox.rowHeight : 0), true);
                if(listBox.style.autoScroll)
@@ -486,20 +484,19 @@ public:
          if(listBox && prev != after)
          {
             DataRow search;
-            int afterIndex = -1;
             int headerSize = ((listBox.style.header) ? listBox.rowHeight : 0);
             int height = listBox.clientSize.h + 1 - headerSize;
             int ixCount = (!collapsed && subRows.count) ? GetLastRow().index - index + 1 : 1;
 
             if(!after || after.index < index)
             {
-               if(after == listBox.firstRowShown.prev) 
+               if((after && after == listBox.firstRowShown.prev) || (!after && !parent /*&& listBox.firstRowShown.prev*/))
                   listBox.firstRowShown = this;
 
                // All rows between AFTER (exclusive) and ROW (exclusive) are incremented by one
                // ROW is equal to AFTER's index + 1
 
-               for(search = after ? after.next : listBox.rows.first; search && search != this; search = search.GetNextRow())
+               for(search = after ? after.next : (parent ? parent.subRows.first : listBox.rows.first); search && search != this; search = search.GetNextRow())
                   search.index += ixCount;
 
                if(after && after.subRows.first && !after.collapsed)
@@ -508,7 +505,7 @@ public:
                   index = search.index + 1;
                }
                else
-                  index = after ? (after.index + 1) : 0;
+                  index = after ? (after.index + 1) : parent ? parent.index + 1 : 0;
 
                // Fix indices of sub rows
                if(!collapsed)
@@ -520,10 +517,12 @@ public:
             }
             else
             {
-               DataRow nextRow = GetNextRow();
+               DataRow nextRow;
+               int afterIXCount = 1;
+
+               nextRow = GetNextRow();
                if(this == listBox.firstRowShown)
                   listBox.firstRowShown = nextRow;
-               index = after.index;
 
                // All rows between ROW (exclusive) and AFTER (inclusive) are decremented by one
                // ROW is equal to AFTER's index
@@ -533,8 +532,33 @@ public:
                   search.index -= ixCount;
                   if(search == after) break;
                }
+
+               // Fix up's after's sub rows
+               if(after && !after.collapsed)
+               {
+                  DataRow last = after.GetLastRow();
+                  if(last != after)
+                  {
+                     int ix = after.index+1;
+                     for(search = after.GetNextRow(); search; search = search.GetNextRow())
+                     {
+                        afterIXCount++;
+                        search.index = ix++;
+                        if(search == last) break;
+                     }
+                  }
+               }
+               index = after.index + afterIXCount;
+
+               // Fix indices of sub rows
+               if(!collapsed)
+               {
+                  int c, ix = index+1;
+                  for(c = 1, search = GetNextRow(); search && c < ixCount; c++, search = search.GetNextRow())
+                     search.index = ix++;
+               }
             }
-            listBox.rows.Move(this, after);
+            (parent ? parent.subRows : listBox.rows).Move(this, after);
 
 #ifdef _DEBUG
             listBox.CheckConsistency();
@@ -568,12 +592,12 @@ public:
       if(this)
       {
          ListBoxCell cell = listBox.GetCell(&this, &field);
-         if(cell && cell.isSet && cell.data)
+         if(cell && cell.isSet)
          {
             if((field.dataType.type == normalClass || field.dataType.type == noHeadClass))
                return cell.data[0];
             else
-               return (void *)cell.data;   // Cast for MemoryGuard
+               return cell.data;
          }
       }
       return null;
@@ -611,7 +635,7 @@ public:
             listBox.modifiedDocument = true;
             listBox.Update(null);
             if(dataType && (dataType.type == normalClass || dataType.type == noHeadClass))
-               return (void *)cell.data;     // Cast for MemoryGuard
+               return cell.data;
             else
                return &cell.data;
          }
@@ -638,8 +662,11 @@ public:
                }
                else
                {
+                  int size = (field.dataType && field.dataType.typeSize) ?
+                     (sizeof(class ListBoxCell) + field.dataType.typeSize - sizeof(void *)) : sizeof(class ListBoxCell);
                   // Free old data first
                   ((void (*)(void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnFree])(dataType, cell.data);
+                  FillBytes(cell.data, 0, size - (uint)(uintptr)&((ListBoxCell)0).data);
                }
             }
             cell.isSet = false;
@@ -698,11 +725,11 @@ public:
                      break;
                if(field)
                {
-                  int size = (field.dataType && field.dataType.typeSize) ? 
+                  int size = (field.dataType && field.dataType.typeSize) ?
                      (sizeof(class ListBoxCell) + field.dataType.typeSize - sizeof(void *)) : sizeof(class ListBoxCell);
                   ListBoxCell cell = (ListBoxCell)new0 byte[size];
                   row.cells.Add(cell);
-                  FillBytes(cell.data, 0, size - (uint)&((ListBoxCell)0).data);
+                  FillBytes(cell.data, 0, size - (uint)(uintptr)&((ListBoxCell)0).data);
                   cell.isSet = false;
                }
             }
@@ -723,11 +750,11 @@ public:
                listBox.rowCount++;
 
                for(search = row.GetNextRow(); search; search = search.GetNextRow())
-                  search.index++;            
+                  search.index++;
 
                listBox.SetScrollArea(
                   listBox.width,
-                  (listBox.rowCount * listBox.rowHeight) + 
+                  (listBox.rowCount * listBox.rowHeight) +
                   ((listBox.style.header) ? listBox.rowHeight : 0) -
                   ((!((listBox.clientSize.h+1) % listBox.rowHeight)) ? listBox.rowHeight : 0), true);
                if(listBox.style.autoScroll)
@@ -751,7 +778,7 @@ public:
       return null;
    }
 
-   DataRow AddStringf(char * format, ...)
+   DataRow AddStringf(const char * format, ...)
    {
       if(this)
       {
@@ -770,7 +797,7 @@ public:
       return null;
    }
 
-   DataRow AddString(char * string)
+   DataRow AddString(const char * string)
    {
       if(this)
       {
@@ -786,7 +813,7 @@ public:
 private:
    DataRow()
    {
-      subRows.offset = (uint)&((DataRow)0).prev;
+      subRows.offset = (uint)(uintptr)&((DataRow)0).prev;
    }
 
    ~DataRow()
@@ -835,8 +862,8 @@ private:
       int result = 0;
       ListBoxCell cell1, cell2;
       uint index;
-      for(index = 0, cell1 = cells.first, cell2 = b.cells.first; 
-          index != sortField.index; 
+      for(index = 0, cell1 = cells.first, cell2 = b.cells.first;
+          index != sortField.index;
           index++, cell1 = cell1.next, cell2 = cell2.next);
    /*
       if(!cell1.isSet && !cell2.isSet)
@@ -854,14 +881,14 @@ private:
       {
          if(sortField.dataType.type == normalClass || sortField.dataType.type == noHeadClass)
          {
-            result = ((int (*)(void *, void *, void *))(void *)sortField.dataType._vTbl[__ecereVMethodID_class_OnCompare])(sortField.dataType, 
-               (cell1.isSet && cell1.data) ? cell1.data[0] : null, 
-               (cell2.isSet && cell2.data) ? cell2.data[0] : null);
+            result = ((int (*)(void *, void *, void *))(void *)sortField.dataType._vTbl[__ecereVMethodID_class_OnCompare])(sortField.dataType,
+               cell1.isSet ? cell1.data[0] : null,
+               cell2.isSet ? cell2.data[0] : null);
          }
          else
          {
-            result = ((int (*)(void *, void *, void *))(void *)sortField.dataType._vTbl[__ecereVMethodID_class_OnCompare])(sortField.dataType, 
-               cell1.isSet ? cell1.data : null, 
+            result = ((int (*)(void *, void *, void *))(void *)sortField.dataType._vTbl[__ecereVMethodID_class_OnCompare])(sortField.dataType,
+               cell1.isSet ? cell1.data : null,
                cell2.isSet ? cell2.data : null);
          }
       }
@@ -884,9 +911,9 @@ private:
 
          {
             DataRow search;
-            int index = this.index;
+            int ix = index;
             for(search = this; search; search = search.GetNextRow())
-               search.index = index++;
+               search.index = ix++;
          }
          if(scrollToCurrent)
          {
@@ -918,9 +945,9 @@ private:
    {
       DataRow row;
       // Find Next row
-      if(subRows.first && !collapsed) 
+      if(subRows.first && !collapsed)
          row = subRows.first;
-      else 
+      else
       {
          for(row = this; row; row = row.parent)
          {
@@ -964,7 +991,7 @@ public class ListBox : CommonControl
 public:
    // Properties
    property bool freeSelect { property_category $"Behavior" set { style.freeSelect = value; } get { return style.freeSelect; } };
-   property DataRow currentRow { property_category $"Private" /*"Behavior"*/ set { SetCurrentRow(value, false); } get { return currentRow; } };
+   property DataRow currentRow { property_category $"Private" /*"Behavior"*/ set { if(this) SetCurrentRow(value, false); } get { return this ? currentRow : null; } };
    property DataField currentField
    {
       get { return currentField; }
@@ -980,7 +1007,7 @@ public:
 
    property int rowHeight
    {
-      property_category $"Appearance" 
+      property_category $"Appearance"
       isset { return style.heightSet; }
       set
       {
@@ -997,11 +1024,11 @@ public:
             OnApplyGraphics();
          }
       }
-      get { return rowHeight; }
+      get { return this ? rowHeight : 0; }
    };
    property Seconds typingTimeout
    {
-      property_category $"Behavior" 
+      property_category $"Behavior"
       set
       {
          typedString[0] = '\0';
@@ -1018,7 +1045,7 @@ public:
    property bool hasClearHeader { property_category $"Appearance" set { style.clearHeader = value; if(value) property::hasHeader = true; } get { return style.clearHeader; } };
    property bool hasHeader
    {
-      property_category $"Appearance" 
+      property_category $"Appearance"
       set
       {
          if(value && !style.header)
@@ -1044,7 +1071,7 @@ public:
          style.header = value;
       }
       get { return style.header; }
-   };   
+   };
    property bool multiSelect { property_category $"Behavior" set { style.multiSelect = value; } get { return style.multiSelect; } };
    property bool alwaysEdit { property_category $"Behavior" set { style.alwaysEdit = value; } get { return style.alwaysEdit; } };
    property bool fullRowSelect { property_category $"Appearance" set { style.fullRowSelect = value; } get { return style.fullRowSelect; } };
@@ -1055,7 +1082,7 @@ public:
    property bool noDragging { property_category $"Behavior" set { style.noDragging = value; } get { return style.noDragging; } };
    property bool fillLastField
    {
-      property_category $"Behavior" 
+      property_category $"Behavior"
       set
       {
          style.fillLastField = value;
@@ -1106,8 +1133,9 @@ public:
    virtual bool Window::NotifyResized(ListBox listBox, DataField field, Modifiers mods);
    virtual bool Window::NotifyCollapse(ListBox listBox, DataRow row, bool collapsed);
    virtual bool Window::NotifyKeyHit(ListBox listBox, DataRow row, Key key, unichar ch);
-   virtual bool Window::NotifyModified(ListBox listBox, DataRow row);   
+   virtual bool Window::NotifyModified(ListBox listBox, DataRow row);
    virtual bool Window::NotifyEditing(ListBox listBox, DataRow row);
+   virtual void Window::NotifyMoved(ListBox listBox, DataRow row, Modifiers mods);
 
 #ifdef _DEBUG
    private void CheckConsistency()
@@ -1144,7 +1172,7 @@ public:
          incref addedField;
          addedField.listBox = this;
          fields.Add(addedField);
-      
+
          addedField.sortOrder = 1;
          addedField.index = numFields;
          numFields++;
@@ -1158,7 +1186,7 @@ public:
                stayOnTop = true;
                inactive = true;
                dontScrollVert = true;
-               id = (uint64)addedField;
+               id = (int64)(intptr)addedField;
                text = addedField.header;
                bevel = (!guiApp.textMode && !style.clearHeader);
                ellipsis = true;
@@ -1181,16 +1209,16 @@ public:
             field = addedField;
             for(row = rows.first; row; )
             {
-               int size = (field.dataType && field.dataType.typeSize) ? 
+               int size = (field.dataType && field.dataType.typeSize) ?
                   (sizeof(class ListBoxCell) + field.dataType.typeSize - sizeof(void *)) : sizeof(class ListBoxCell);
                ListBoxCell cell = (ListBoxCell)new0 byte[size];
                row.cells.Add(cell);
-               FillBytes(cell.data, 0, size - (uint)&((ListBoxCell)0).data);
+               FillBytes(cell.data, 0, size - (uint)(uintptr)&((ListBoxCell)0).data);
                cell.isSet = false;
 
-               if(row.subRows.first) 
+               if(row.subRows.first)
                   row = row.subRows.first;
-               else 
+               else
                {
                   for(; row; row = row.parent)
                   {
@@ -1255,9 +1283,9 @@ public:
                   delete cell;
                }
 
-               if(row.subRows.first) 
+               if(row.subRows.first)
                   row = row.subRows.first;
-               else 
+               else
                {
                   for(; row; row = row.parent)
                   {
@@ -1281,24 +1309,22 @@ public:
       if(row)
       {
          DataRow search;
-         DataField field;
-         int c;
 
          row.index = 0;
          rows.Insert(null, row);
          row.listBox = this;
 
          for(search = row.GetNextRow(); search; search = search.GetNextRow())
-            search.index++;         
+            search.index++;
 
-         this.rowCount++;
+         rowCount++;
          row.cells.Clear();
-         
+
          firstRowShown = row;
 
          SetScrollArea(
             width,
-            (rowCount * rowHeight) + 
+            (rowCount * rowHeight) +
             ((style.header) ? rowHeight : 0) -
             ((!((clientSize.h+1) % rowHeight)) ? rowHeight : 0), true);
          if(style.autoScroll)
@@ -1325,8 +1351,7 @@ public:
                // Find very last row
                {
                   DataRow lastRow;
-                  for(lastRow = rows.last; lastRow && !lastRow.collapsed && lastRow.subRows.last; lastRow)
-                     lastRow = lastRow.subRows.last;
+                  for(lastRow = rows.last; lastRow && !lastRow.collapsed && lastRow.subRows.last; lastRow = lastRow.subRows.last);
                   row.index = lastRow ? (lastRow.index + 1) : 0;
                }
 
@@ -1342,11 +1367,11 @@ public:
                         break;
                   if(field)
                   {
-                     int size = (field.dataType && field.dataType.typeSize) ? 
+                     int size = (field.dataType && field.dataType.typeSize) ?
                         (sizeof(class ListBoxCell) + field.dataType.typeSize - sizeof(void *)) : sizeof(class ListBoxCell);
                      ListBoxCell cell = (ListBoxCell) new0 byte[size];
                      row.cells.Add(cell);
-                     FillBytes(cell.data, 0, size - (uint)&((ListBoxCell)0).data);
+                     FillBytes(cell.data, 0, size - (uint)(uintptr)&((ListBoxCell)0).data);
                      cell.isSet = false;
                   }
                }
@@ -1359,7 +1384,7 @@ public:
                if(rowHeight)
                   SetScrollArea(
                      width,
-                     (rowCount * rowHeight) + 
+                     (rowCount * rowHeight) +
                      ((style.header) ? rowHeight : 0) -
                      ((!((clientSize.h+1) % rowHeight)) ? rowHeight : 0), true);
                if(style.autoScroll)
@@ -1399,9 +1424,9 @@ public:
             row.listBox = this;
 
             for(search = row.GetNextRow(); search; search = search.GetNextRow())
-               search.index++;         
+               search.index++;
 
-            this.rowCount++;
+            rowCount++;
             row.cells.Clear();
             for(c = 0; c<fields.count; c++)
             {
@@ -1410,11 +1435,11 @@ public:
                      break;
                if(field)
                {
-                  int size = (field.dataType && field.dataType.typeSize) ? 
+                  int size = (field.dataType && field.dataType.typeSize) ?
                      (sizeof(class ListBoxCell) + field.dataType.typeSize - sizeof(void *)) : sizeof(class ListBoxCell);
                   ListBoxCell cell = (ListBoxCell) new0 byte[size];
                   row.cells.Add(cell);
-                  FillBytes(cell.data, 0, size - (uint)&((ListBoxCell)0).data);
+                  FillBytes(cell.data, 0, size - (uint)(uintptr)&((ListBoxCell)0).data);
                   cell.isSet = false;
                }
             }
@@ -1425,7 +1450,7 @@ public:
 
             SetScrollArea(
                width,
-               (rowCount * rowHeight) + 
+               (rowCount * rowHeight) +
                ((style.header) ? rowHeight : 0) -
                ((!((clientSize.h+1) % rowHeight)) ? rowHeight : 0), true);
             if(style.autoScroll)
@@ -1440,7 +1465,7 @@ public:
       return null;
    }
 
-   DataRow AddStringf(char * format, ...)
+   DataRow AddStringf(const char * format, ...)
    {
       if(this)
       {
@@ -1461,7 +1486,7 @@ public:
       return null;
    }
 
-   DataRow AddString(char * string)
+   DataRow AddString(const char * string)
    {
       if(this)
       {
@@ -1497,20 +1522,20 @@ public:
          if(row.parent.IsExpanded())
          {
             for(search = row.GetNextRow(); search; search = search.GetNextRow())
-               search.index--;         
-            this.rowCount--;
+               search.index--;
+            rowCount--;
          }
 
          HideEditBox(false, false, true);
 
-         if(row == clickedRow) 
+         if(row == clickedRow)
          {
             clickedRow = row.GetNextRow();
             if(!clickedRow)
                clickedRow = row.GetPrevRow();
          }
 
-         if(row == currentRow) 
+         if(row == currentRow)
          {
             DataRow newCurrentRow = row.GetNextRow();
             if(!newCurrentRow)
@@ -1518,7 +1543,7 @@ public:
             SetCurrentRow(newCurrentRow, true);
          }
 
-         if(row == firstRowShown) 
+         if(row == firstRowShown)
          {
             firstRowShown = row.GetPrevRow();
             if(!firstRowShown)
@@ -1531,8 +1556,8 @@ public:
          //HideEditBox(false, false, true);
 
          SetScrollArea(
-            this.width,
-            (this.rowCount * rowHeight) + 
+            width,
+            (rowCount * rowHeight) +
             ((style.header) ? rowHeight : 0) -
             ((!((clientSize.h+1) % rowHeight)) ? rowHeight : 0), true);
 
@@ -1560,11 +1585,10 @@ public:
       return null;
    }
 
-   DataRow FindString(char * searchedString)
+   DataRow FindString(const char * searchedString)
    {
       DataField field;
       bool checkNextField = true;
-      int len = searchedString ? strlen(searchedString) : 0;
 
       for(field = fields.first; field; field = field.next)
       {
@@ -1578,7 +1602,7 @@ public:
                   void * data = row.GetData(field);
                   char tempString[1024] = "";
                   bool needClass = false;
-                  char * string = ((char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, data, tempString, null, &needClass);
+                  const char * string = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, data, tempString, null, &needClass);
 
                   if(string && string[0])
                      checkNextField = false;
@@ -1592,7 +1616,7 @@ public:
       return null;
    }
 
-   DataRow FindSubString(char * subString)
+   DataRow FindSubString(const char * subString)
    {
       DataField field;
       bool checkNextField = true;
@@ -1612,7 +1636,7 @@ public:
                      void * data = row.GetData(field);
                      char tempString[1024] = "";
                      bool needClass = false;
-                     char * string = ((char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, data, tempString, null, &needClass);
+                     const char * string = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, data, tempString, null, &needClass);
 
                      if(string && string[0])
                         checkNextField = false;
@@ -1627,13 +1651,13 @@ public:
       return null;
    }
 
-   DataRow FindSubStringi(char * subString)
+   DataRow FindSubStringi(const char * subString)
    {
       DataField field;
       bool checkNextField = true;
       int len = subString ? strlen(subString) : 0;
       DataRow result = null;
-      char * bestResult = null;
+      const char * bestResult = null;
       int bestLen = 0;
 
       if(len)
@@ -1650,7 +1674,7 @@ public:
                      void * data = row.GetData(field);
                      char tempString[1024] = "";
                      bool needClass = false;
-                     char * string = ((char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, data, tempString, null, &needClass);
+                     const char * string = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, data, tempString, null, &needClass);
 
                      if(string && string[0])
                         checkNextField = false;
@@ -1679,7 +1703,7 @@ public:
       return result;
    }
 
-   DataRow FindSubStringAfter(DataRow after, char * subString)
+   DataRow FindSubStringAfter(DataRow after, const char * subString)
    {
       DataField field;
       bool checkNextField = true;
@@ -1699,7 +1723,7 @@ public:
                      void * data = row.GetData(field);
                      char tempString[1024] = "";
                      bool needClass = false;
-                     char * string = ((char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, data, tempString, null, &needClass);
+                     const char * string = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, data, tempString, null, &needClass);
 
                      if(string && string[0])
                         checkNextField = false;
@@ -1719,7 +1743,7 @@ public:
       if(this)
       {
          DataRow row = null;
-      
+
          for(row = rows.first; row; row = row.next)
          {
             if(!row.noneRow && row.tag == tag)
@@ -1744,10 +1768,10 @@ public:
 
          HideEditBox(false, true, false);
          editData.Destroy(0);
-               
+
          firstRowShown = currentRow = null;
          ClearEx();
-     
+
          if(master)
          {
             if(style.freeSelect)
@@ -1759,12 +1783,12 @@ public:
          if(style.alwaysEdit && currentRow)
             currentRow.Edit(currentField);
 
-      
-         this.rowCount = 0;
-      
+
+         rowCount = 0;
+
          SetScrollArea(
-               this.width,
-               (this.rowCount * rowHeight) + 
+               width,
+               (rowCount * rowHeight) +
                ((style.header) ? rowHeight : 0) -
                ((rowHeight && !((clientSize.h+1) % rowHeight)) ? rowHeight : 0), true);
          Update(null);
@@ -1847,8 +1871,8 @@ private:
    ListBox()
    {
       DataField defaultField { };
-      rows.offset = (uint)&((DataRow)0).prev;
-      fields.offset = (uint)&((DataField)0).prev;
+      rows.offset = (uint)(uintptr)&((DataRow)0).prev;
+      fields.offset = (uint)(uintptr)&((DataField)0).prev;
       style.fullRowSelect = true;
       style.fillLastField = true;
       style.expandOnAdd = true;
@@ -1902,7 +1926,7 @@ private:
       if(*row)
       {
          if(!*field) *field = this ? currentField : null;
-         if(!*field && this) 
+         if(!*field && this)
          {
             for(*field = fields.first; (*field).index != 0; *field = (*field).next);
          }
@@ -1922,10 +1946,9 @@ private:
    {
       if(editData && editData.visible)
       {
-         Class dataType = currentField.dataType;
-         if(save) 
+         if(save)
             editData.SaveData();
-         
+
          editData.visible = false;
          NotifyEditDone(master, this, currentRow);
 
@@ -1938,7 +1961,7 @@ private:
             int height = rowHeight - (style.alwaysEdit ? 1 : 0);
             int y = currentRow.index * rowHeight + (style.header ? rowHeight : 0);
             int x = currentField.x;
-            int width = (!currentField.next && style.fillLastField && (!hasHorzScroll || clientSize.w - currentField.x > currentField.width + EXTRA_SPACE)) ? 
+            int width = (!currentField.next && style.fillLastField && (!hasHorzScroll || clientSize.w - currentField.x > currentField.width + EXTRA_SPACE)) ?
                   clientSize.w - currentField.x : (currentField.width + EXTRA_SPACE);
 
             if(!style.alwaysEdit)
@@ -1957,17 +1980,59 @@ private:
             */
             PopupEditBox(currentField, repositionOnly);
          }
-         else
-            printf("");
-            
+
          /*else
             currentField = null;*/
       }
    }
 
+#ifdef _DEBUG
+   static bool DebugFindRow(DataRow parent, DataRow row)
+   {
+      bool found = false;
+      DataRow r;
+      for(r = parent.subRows.first; r; r = r.next)
+      {
+         if(r == row)
+         {
+            found = true;
+            break;
+         }
+         if(DebugFindRow(r, row))
+         {
+            found = true;
+            break;
+         }
+      }
+      return found;
+   }
+#endif
+
    void SetCurrentRow(DataRow row, bool notify)
    {
-      if(currentRow != row || (currentRow && currentRow.selectedFlag == unselected))
+#if _DEBUG
+      if(this && row)
+      {
+         bool found = false;
+         DataRow r;
+         for(r = rows.first; r; r = r.next)
+         {
+            if(r == row)
+            {
+               found = true;
+               break;
+            }
+            if(DebugFindRow(r, row))
+            {
+               found = true;
+               break;
+            }
+         }
+         if(!found)
+            PrintLn("ERROR: Setting currentRow to a row not found in ListBox!!");
+      }
+#endif
+      if(this && (currentRow != row || (currentRow && currentRow.selectedFlag == unselected)))
       {
          int headerSize = ((style.header) ? rowHeight : 0);
          int height = clientSize.h + 1 - headerSize;
@@ -2022,6 +2087,38 @@ private:
       }
    }
 
+   void RepositionFieldEditor()
+   {
+      if(editData && editData.visible)
+      {
+         int height = rowHeight - (style.alwaysEdit ? 1 : 0);
+         int x = 0;
+         int y = currentRow.index * rowHeight + (style.header ? rowHeight : 0);
+         int width = 0;
+         DataField field;
+
+         if(style.collapse && !(style.treeBranch))
+            x += 15;
+         for(field = fields.first; field; field = field.next)
+         {
+            width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
+               clientSize.w - field.x : (field.width + EXTRA_SPACE);
+            if(field == currentField) break;
+            x += width;
+         }
+         if(!style.alwaysEdit)
+         {
+            editData.position = { x, y - editData.clientStart.y };
+            editData.size = { width, height + editData.clientStart.y * 2 };
+         }
+         else
+         {
+            editData.position = { x, y };
+            editData.size = { width, height };
+         }
+      }
+   }
+
    void PopupEditBox(DataField whichField, bool repositionOnly)
    {
       if((!editData || !editData.visible || currentField != whichField) && currentRow)
@@ -2033,7 +2130,7 @@ private:
             int height = rowHeight - (style.alwaysEdit ? 1 : 0);
             int x = 0;
             int y = currentRow.index * rowHeight + (style.header ? rowHeight : 0);
-            int width;
+            int width = 0;
             //void * data = currentRow.GetData(whichField);
             DataField field;
             DataRow row = null;
@@ -2044,7 +2141,7 @@ private:
 
             for(field = fields.first; field; field = field.next)
             {
-               width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ? 
+               width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
                   clientSize.w - field.x : (field.width + EXTRA_SPACE);
                if(field == whichField) break;
                x += width;
@@ -2061,7 +2158,7 @@ private:
                   background = dataBoxBackground;
                   foreground = dataBoxForeground;
 
-                  bool NotifyChanged(bool closingDropDown)
+                  bool NotifyChanged(DataBox dataBox, bool closingDropDown)
                   {
                      DataRow row = null;
                      DataField field = null;
@@ -2093,7 +2190,7 @@ private:
                      bool result = DataBox::OnKeyDown(key, ch);
                      if(visible && active)   // Added this check here, because we will not use enter/escape otherwise, and lose DataBox's result
                      {
-                        if((SmartKey)key == enter || (SmartKey)key == escape) 
+                        if((SmartKey)key == enter || (SmartKey)key == escape)
                            return true;
                      }
                      return result;
@@ -2146,7 +2243,6 @@ private:
       Font font = fontObject;
       Font boldFont = this.boldFont.font;
 
-
       // Draw gray grid
       if(style.alwaysEdit && style.fullRowSelect)
       {
@@ -2159,7 +2255,7 @@ private:
          DataField field;
 
          // Fill out indent column
-         if(style.collapse && !(style.treeBranch) && rows.first)
+         if(style.collapse && !(style.treeBranch) && (style.header || rows.first))
          {
             x += 15;
             surface.SetBackground(formColor);
@@ -2178,7 +2274,7 @@ private:
          // Vertical lines
          for(field = fields.first; field; field = field.next)
          {
-            int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ? 
+            int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
                clientSize.w - field.x : (field.width + EXTRA_SPACE);
             if(field.prev && y > 0)
                surface.VLine(0, y-1, x);
@@ -2218,7 +2314,7 @@ private:
                int y1 = y + PLUSY + 4;
                int y2;
                DataRow child;
-            
+
                for(child = row.collapsed ? null : row.subRows.first; child && child != row; )
                {
                   numRows++;
@@ -2291,7 +2387,7 @@ private:
          int indent = 0;
          DataRow parent;
          Bitmap icon = row.icon ? row.icon.bitmap : null;
-         int collapseRowStart;
+         int collapseRowStart = 0;
          bool lastWasHeader = row.header;
 
          for(parent = row.parent; parent; parent = parent.parent)
@@ -2355,8 +2451,8 @@ private:
             Color colors[] = { formColor, azure, mistyRose, linen, floralWhite, lavender, lavenderBlush, lemonChiffon };
             int level = 0;
             DataRow p = row;
-            while(p = p.parent) level++;
-            background = colors[(level % (sizeof(colors)/sizeof(colors[0]))];
+            while((p = p.parent)) level++;
+            background = colors[level % (sizeof(colors)/sizeof(colors[0]))];
             surface.SetBackground(background);
             surface.Area(rowStart, y, clientSize.w, (y + rowHeight) - 1);
             foreground = branchesColor;
@@ -2404,11 +2500,11 @@ private:
             surface.SetForeground(foreground);
             surface.SetBackground(background);
 
-            ((void (*)(void *, void *, void *, int, int, int, void *, uint, uint))(void *)class(String)._vTbl[__ecereVMethodID_class_OnDisplay])(class(String), "(none)", surface, x, y - 1 + (rowHeight - fontH)/2, width - EXTRA_SPACE/2, null, Alignment::left, dataDisplayFlags);
+            ((void (*)(void *, const void *, void *, int, int, int, void *, uint, uint))(void *)class(String)._vTbl[__ecereVMethodID_class_OnDisplay])(class(String), "(none)", surface, x, y - 1 + (rowHeight - fontH)/2, width - EXTRA_SPACE/2, null, Alignment::left, dataDisplayFlags);
          }
          else
          {
-            if(!opacity) surface.TextOpacity(false);
+            if(opacity < 1) surface.TextOpacity(false);
             // Draw the rows
             for(field = fields.first; field; field = field.next)
             {
@@ -2472,6 +2568,10 @@ private:
                   foreground = this.background;
                }
 
+#ifdef _DEBUG
+               // surface.WriteTextf(x + 100, y,  "ix: %d", row.index);
+#endif
+
                x += width;// + EXTRA_SPACE;
 
                if(row.header) break;
@@ -2520,17 +2620,17 @@ private:
             break;
       }
       if(firstRowShown) surface.Clip(null);
-      if(this.dragRow && this.dropIndex != -1)
+      if(dragRow && dropIndex != -1)
       {
-         int dropIndex = this.dropIndex;
+         int ix = dropIndex;
          int y;
 
-         if(!style.multiSelect && currentRow.index < this.dropIndex)
-            dropIndex++;
+         if(!style.multiSelect && currentRow.index < dropIndex)
+            ix++;
          surface.DrawingChar(223);
 
          y = style.header ? rowHeight : 0;
-         y += dropIndex * rowHeight - scroll.y;
+         y += ix * rowHeight - scroll.y;
 
          surface.SetForeground(Color { 85, 85, 255 });
          surface.HLine(0, clientSize.w-1, y);
@@ -2540,11 +2640,11 @@ private:
 
    void OnDrawOverChildren(Surface surface)
    {
-      if(draggingField && this.dropField)
+      if(draggingField && dropField)
       {
-         int position = this.dropField.x;
+         int position = dropField.x;
          if(draggingField.x < position)
-            position += this.dropField.width + EXTRA_SPACE;
+            position += dropField.width + EXTRA_SPACE;
 
          surface.SetForeground(Color { 85, 85, 255 });
          surface.VLine(0, rowHeight - 1, position - scroll.x - 2);
@@ -2553,7 +2653,7 @@ private:
       if(sortField && !style.clearHeader && style.header)
       {
          DataField field = sortField;
-         int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ? 
+         int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
             clientSize.w - field.x : (field.width + EXTRA_SPACE);
          int tw = 0, th = 0;
          if(field.header)
@@ -2562,9 +2662,9 @@ private:
          {
             bool up = field.sortOrder == 1;
             int x = 4, y = 4;
-            Box clip = 
-            { 
-               field.x + 2 - scroll.x, 0, 
+            Box clip =
+            {
+               field.x + 2 - scroll.x, 0,
                field.x + width + EXTRA_SPACE - 1 - scroll.x, rowHeight
             };
             surface.Clip(&clip);
@@ -2574,7 +2674,7 @@ private:
                   x = field.x + (width + EXTRA_SPACE - tw) / 2 + tw + EXTRA_SPACE + 4;
                else
                   x = field.x + tw + EXTRA_SPACE + 4;
-             
+
                x = Min(x, field.x + width - 4);
             }
             else if(field.alignment == right)
@@ -2598,7 +2698,7 @@ private:
                   surface.PutPixel(x + 1, y + 5);
                   surface.PutPixel(x + 1, y + 3);
                   surface.PutPixel(x + 2, y + 1);
-            
+
                   surface.SetForeground(white);
                   surface.DrawLine(x + 4, y, x + 7, y + 5);
                   surface.PutPixel(x + 6, y + 5);
@@ -2614,7 +2714,7 @@ private:
                   surface.PutPixel(x + 1, y+1);
                   surface.PutPixel(x + 1, y+3);
                   surface.PutPixel(x + 2, y+5);
-            
+
                   surface.SetForeground(white);
                   surface.DrawLine(x + 4, y+6, x + 7, y+1);
                   surface.PutPixel(x + 6, y+1);
@@ -2647,13 +2747,13 @@ private:
 
       SetScrollArea(
          width,
-         (rowCount * rowHeight) + 
+         (rowCount * rowHeight) +
          ((style.header) ? rowHeight : 0) -
          ((!((clientSize.h+1) % rowHeight)) ? rowHeight : 0), true);
 
       for(field = fields.first; field; field = field.next)
       {
-         int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ? 
+         int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
             clientSize.w - field.x : (field.width + EXTRA_SPACE);
          if(style.header && field.headButton)
          {
@@ -2682,6 +2782,8 @@ private:
       {
          HideEditBox(true, false, true);
       }
+      else if(editData && editData.visible)
+         RepositionFieldEditor();
    }
 
    void AdaptToFieldWidth(DataField field, bool doScroll)
@@ -2705,11 +2807,11 @@ private:
 
    bool HeaderPushed(Button control, int x, int y, Modifiers mods)
    {
-      DataField field = (DataField)control.id;
+      DataField field = (DataField)(intptr)control.id;
       // false: dont destroy edit box
       HideEditBox(true, false, true);
       if(style.resizable && ((!field && x < RESIZE_BORDER && fields.last) ||
-         (field && x < RESIZE_BORDER && field.prev) || 
+         (field && x < RESIZE_BORDER && field.prev) ||
          (field && x >= control.clientSize.w - RESIZE_BORDER)))
       {
          if(!field)
@@ -2719,9 +2821,9 @@ private:
 
          if(field.fixed) return false;
          resizingField = field;
-         this.resizeX = x + control.position.x;
-         this.startWidth = field.width;
-         this.oldX = x - scroll.x;
+         resizeX = x + control.position.x;
+         startWidth = field.width;
+         oldX = x - scroll.x;
          return false;
       }
       else if(field)
@@ -2748,15 +2850,15 @@ private:
          x += control.position.x;
 
          // Tweak to prevent shrinking field if we're actually moving right
-         if(x - scroll.x > this.oldX && 
-            this.startWidth + x - this.resizeX < field.width)
+         if(x - scroll.x > oldX &&
+            startWidth + x - resizeX < field.width)
          {
-            this.oldX = x - scroll.x;
+            oldX = x - scroll.x;
             return true;
          }
-         this.oldX = x - scroll.x;
+         oldX = x - scroll.x;
 
-         field.width = this.startWidth + x - this.resizeX;
+         field.width = startWidth + x - resizeX;
          field.width = Max(field.width, - EXTRA_SPACE);
 
          AdaptToFieldWidth(field, true);
@@ -2770,9 +2872,9 @@ private:
             int fieldX = 0;
             for(field = fields.first; field; field = field.next)
             {
-               fieldX += ((field.width || style.resizable) ? 
+               fieldX += ((field.width || style.resizable) ?
                   field.width : clientSize.w) + EXTRA_SPACE;
-               if(fieldX > x) 
+               if(fieldX > x)
                   break;
             }
             if(draggingField == field)
@@ -2782,7 +2884,7 @@ private:
                        field.x >= field.x + field.width + EXTRA_SPACE - clientSize.w)
                {
                   SetScrollPosition(
-                     field.x + field.width + EXTRA_SPACE - clientSize.w, 
+                     field.x + field.width + EXTRA_SPACE - clientSize.w,
                      scroll.y);
                }
                else if(field.x + field.width + EXTRA_SPACE - clientSize.w > scroll.x ||
@@ -2790,9 +2892,9 @@ private:
                   SetScrollPosition(field.x, scroll.y);
                field = null;
             }
-            if(this.dropField != field)
+            if(dropField != field)
             {
-               this.dropField = field;
+               dropField = field;
                if(field)
                {
                   int position = field.x;
@@ -2810,7 +2912,7 @@ private:
                         SetScrollPosition(position, scroll.y);
                   }
 
-                  this.movingFields = true;
+                  movingFields = true;
                }
                Update(null);
             }
@@ -2818,7 +2920,7 @@ private:
       }
       else if(style.resizable)
       {
-         DataField field = (DataField)control.id;
+         DataField field = (DataField)(intptr)control.id;
          if(field)
          {
             if(x < RESIZE_BORDER && field.prev)
@@ -2853,7 +2955,7 @@ private:
       if(draggingField)
       {
          bool result = true;
-         
+
          if(style.moveFields)
          {
             if(dropField)
@@ -2866,15 +2968,15 @@ private:
                x += draggingField.x;
                for(field = fields.first; field; field = field.next)
                {
-                  fieldX += ((field.width || style.resizable) ? 
+                  fieldX += ((field.width || style.resizable) ?
                      field.width : clientSize.w) + EXTRA_SPACE;
-                  if(fieldX > x) 
+                  if(fieldX > x)
                   {
                      switchField = field;
                      break;
                   }
                }
-               if(switchField && draggingField != switchField && this.dropField)
+               if(switchField && draggingField != switchField && dropField)
                {
                   for(field = fields.first; field; field = field.next)
                   {
@@ -2906,9 +3008,9 @@ private:
 
    bool HeaderClicked(Button control, int x, int y, Modifiers mods)
    {
-      if(style.header && !this.dropField && style.sortable)
+      if(style.header && !dropField && style.sortable)
       {
-         DataField field = (DataField)control.id;
+         DataField field = (DataField)(intptr)control.id;
          if(sortField == field)
             field.sortOrder *= -1;
          else
@@ -2926,7 +3028,7 @@ private:
    {
       if(style.resizable)
       {
-         DataField field = (DataField)control.id;
+         DataField field = (DataField)(intptr)control.id;
          if(field)
          {
             if(x < RESIZE_BORDER && field.prev)
@@ -2955,7 +3057,7 @@ private:
          if(!visible)
          {
             ReleaseCapture();
-            this.rolledOver = this.dragging = false;
+            rolledOver = dragging = false;
          }
          /*else
             Capture();*/
@@ -2964,7 +3066,7 @@ private:
 
    bool OnLoadGraphics()
    {
-      display.FontExtent(fontObject, "W", 1, null, &fontH); 
+      display.FontExtent(fontObject, "W", 1, null, &fontH);
       if(!style.heightSet)
       {
          rowHeight = Max(fontH + 2, 16) + (style.alwaysEdit ? 1 : 0);
@@ -3004,7 +3106,7 @@ private:
             Font font = fontObject;
             Font boldFont = this.boldFont.font;
             Display display = this.display;
-            
+
             for(row = rows.first; row; row = row.GetNextRow())
             {
                Bitmap icon = row.icon ? row.icon.bitmap : null;
@@ -3043,12 +3145,12 @@ private:
                      if(cell && cell.isSet && field.dataType)
                      {
                         static char tempString[4096];
-                        char * string;
+                        const char * string;
                         int tw, th;
                         if(field.dataType.type == normalClass || field.dataType.type == noHeadClass)
-                           string = ((char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, cell.data[0], tempString, field.userData, null);
+                           string = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, cell.data[0], tempString, field.userData, null);
                         else
-                           string = ((char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, cell.data, tempString, field.userData, null);
+                           string = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, cell.data, tempString, field.userData, null);
                         /* GCC-4.4 Bug!
                        if(!string) string = "";
                         display.FontExtent(row.header ? boldFont : font, string, strlen(string), &tw, &th);
@@ -3069,7 +3171,7 @@ private:
          }
          if(!*h)
          {
-            *h = Min(this.maxShown, this.rowCount) * rowHeight;
+            *h = Min(maxShown, rowCount) * rowHeight;
          }
       }
       else
@@ -3108,7 +3210,7 @@ private:
       {
         // Resize left
          DataField field = resizingField;
-         field.width = this.startWidth + x - this.resizeX;
+         field.width = startWidth + x - resizeX;
          field.width = Max(field.width, - EXTRA_SPACE);
 
          AdaptToFieldWidth(field, true);
@@ -3125,7 +3227,7 @@ private:
 
          for(field = fields.first; field; field = field.next)
          {
-            int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ? 
+            int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
                clientSize.w - field.x : (field.width + EXTRA_SPACE);
 
             if(field.prev)
@@ -3142,37 +3244,37 @@ private:
 
       if((editData && editData.visible) || (style.alwaysEdit))
          return true;
-      
+
       if(x == MAXINT && y == MAXINT)
       {
-         x = this.mouseX;
-         y = this.mouseY;
+         x = mouseX;
+         y = mouseY;
          isTimer = true;
       }
 
       // ADDED THIS CHECK FOR FieldDropBox LEAKS
-      if(/*!mods.isSideEffect && */(this.rolledOver || !this.dragging))
+      if(/*!mods.isSideEffect && */(rolledOver || !dragging))
       {
          int rowY = (style.header) ? rowHeight : 0;
-         DataRow row = null;
+         DataRow row = null, nextRow;
          int rowIndex;
 
          mouseX = x;
          mouseY = y;
 
-         if(this.dragging &&
-            ((vertScroll && vertScroll.visible && 
+         if(dragging &&
+            ((vertScroll && vertScroll.visible &&
              (y < 0 || y >= clientSize.h)) ||
-             (horzScroll && horzScroll.visible && 
+             (horzScroll && horzScroll.visible &&
              (x < 0 || x >= clientSize.w))))
          {
             timer.Start();
             if(isTimer)
             {
-               if(vertScroll && vertScroll.visible && 
+               if(vertScroll && vertScroll.visible &&
                   (y < 0 || y >= clientSize.h))
                   vertScroll.Action((y<0)?up:down, 0, 0);
-               if(horzScroll && horzScroll.visible && 
+               if(horzScroll && horzScroll.visible &&
                   (x < 0 || x >= clientSize.w))
                   horzScroll.Action((x<0)?up:down, 0, 0);
             }
@@ -3183,19 +3285,29 @@ private:
          // This must be done after the scrolling took place
          rowIndex = firstRowShown ? firstRowShown.index : -1;
          y = Max(y, 0);
-         y = Min(y, clientSize.h-1);
-         for(row = firstRowShown; row; row = row.GetNextRow(), rowIndex ++)
+         y = Min(y, clientSize.h - ((dragRow && style.moveRows) ? rowHeight : 0)-1);
+         for(row = firstRowShown; row; row = nextRow, rowIndex ++)
          {
+            nextRow = row.GetNextRow();
             rowY += rowHeight;
-            if(rowY > y)
+            if(rowY > y || !nextRow)
             {
                break;
             }
          }
 
+         if(dragRow && style.moveRows)
+         {
+            if(row && row == currentRow)
+               row = row.GetNextRow();
+
+            if(row && row.parent == currentRow)
+               row = row.GetNextRow();
+         }
+
          if(row && currentRow != row)
          {
-            if(this.dragRow && style.moveRows)
+            if(dragRow && style.moveRows)
             {
                if(row.selectedFlag == selected || row.selectedFlag == tempSelected)
                   rowIndex = -1;
@@ -3203,21 +3315,21 @@ private:
                {
                   DataRow thisRow;
                   for(thisRow = rows.first; thisRow; thisRow = thisRow.GetNextRow())
-                     if((thisRow.selectedFlag == selected || thisRow.selectedFlag == tempSelected) || 
+                     if((thisRow.selectedFlag == selected || thisRow.selectedFlag == tempSelected) ||
                         thisRow == row)
                         break;
                   if(thisRow != row)
                      rowIndex++;
                }
-               if(this.dropIndex != rowIndex)
+               if(dropIndex != rowIndex)
                {
-                  this.dropIndex = rowIndex;
-                  this.editRow = null;
+                  dropIndex = rowIndex;
+                  editRow = null;
                   Update(null);
-                  this.movedRow = true;
+                  movedRow = true;
                }
             }
-            else if((style.freeSelect  || this.dragging) && ((realX>= 0 && realY >= 0 && realX< clientSize.w && realY < clientSize.h) || this.rolledOver))
+            else if((style.freeSelect  || dragging) && ((realX>= 0 && realY >= 0 && realX< clientSize.w && realY < clientSize.h) || rolledOver))
             {
                if(!(style.multiSelect))
                {
@@ -3275,8 +3387,8 @@ private:
 
    bool OnMouseOver(int x, int y, Modifiers mods)
    {
-      if(this.dragging)
-         this.rolledOver = true;
+      if(dragging)
+         rolledOver = true;
       return true;
    }
 
@@ -3317,7 +3429,7 @@ private:
 
          for(field = fields.first; field; field = field.next)
          {
-            int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ? 
+            int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
                clientSize.w - field.x : (field.width + EXTRA_SPACE);
 
             if(field.prev)
@@ -3325,8 +3437,8 @@ private:
                if(Abs(x - vx) < 2)
                {
                   resizingField = field.prev;
-                  this.resizeX = x;
-                  this.startWidth = resizingField.width;
+                  resizeX = x;
+                  startWidth = resizingField.width;
                   Capture();
                   SetMouseRangeToClient();
                   break;
@@ -3343,7 +3455,6 @@ private:
          int rowIndex = firstRowShown ? firstRowShown.index : -1;
          DataRow previousRow = currentRow;
          DataRow newCurrentRow = null;
-         DataField newCurrentField = null;
          bool moveMultiple = false;
          int numSelected = 0;
          int rowStart = -scroll.x;
@@ -3371,7 +3482,7 @@ private:
          for(row = firstRowShown; row; row = row.GetNextRow(), rowIndex ++)
          {
             rowY += rowHeight;
-            if(rowY > y || (style.multiSelect && !row.GetNextRow())) 
+            if(rowY > y || (style.multiSelect && !row.GetNextRow()))
             {
                int plusIndent = 0;
                if(style.treeBranch)
@@ -3387,7 +3498,7 @@ private:
                if(style.collapse && row.subRows.first && (row.parent || !(style.treeBranch) || (style.rootCollapse)) &&
                   (x >= rowStart + 3 + plusIndent && y >= rowY - rowHeight + PLUSY && x <= rowStart + 11 + plusIndent && y <= rowY - rowHeight + PLUSY + 8))
                */
-               if(style.collapse && 
+               if(style.collapse &&
                   (x >= rowStart && y >= rowY - rowHeight && x <= rowStart + 18 + plusIndent && y <= rowY + rowHeight-1))
                {
                   if(row.subRows.first && (row.parent || !(style.treeBranch) || (style.rootCollapse)) && x >= plusIndent)
@@ -3409,9 +3520,9 @@ private:
                         for(selRow = rows.first; selRow; selRow = selRow.GetNextRow())
                            selRow.selectedFlag = unselected;
                         clickedRow = row;
-                        //this.clickedRowIndex = rowIndex;
+                        //clickedRowIndex = rowIndex;
                      }
-                     else if(style.moveRows && !(mods.shift) && 
+                     else if(style.moveRows && !(mods.shift) &&
                         (row.selectedFlag == selected || row.selectedFlag == tempSelected) &&
                         !right && !(mods.isActivate))
                         moveMultiple = true;
@@ -3427,7 +3538,7 @@ private:
                               row.selectedFlag = selected;
                            }
                            clickedRow = row;
-                           //this.clickedRowIndex = rowIndex;
+                           //clickedRowIndex = rowIndex;
                         }
                         else
                         {
@@ -3458,7 +3569,7 @@ private:
                                     {
                                        if(selRow != clickedRow)
                                        {
-                                          if(selRow.selectedFlag) 
+                                          if(selRow.selectedFlag)
                                              selRow.selectedFlag = tempUnselected;
                                           else
                                              selRow.selectedFlag = tempSelected;
@@ -3502,7 +3613,7 @@ private:
                               else
                                  row.selectedFlag = tempSelected;
                               clickedRow = row;
-                              //this.clickedRowIndex = rowIndex;
+                              //clickedRowIndex = rowIndex;
                            }
                         }
                      }
@@ -3583,7 +3694,7 @@ private:
 
          if(style.freeSelect)
             NotifyHighlight(master, this, currentRow, mods);
-         else if((moveMultiple || (!(style.multiSelect) && previousRow == currentRow)) && 
+         else if((moveMultiple || (!(style.multiSelect) && previousRow == currentRow)) &&
             newCurrentRow && !(mods.shift))
          {
             if(!right)
@@ -3592,9 +3703,11 @@ private:
                {
                   if(style.moveRows)
                   {
-                     this.dragRow = currentRow;
-                     this.dropIndex = -1;
-                     this.movedRow = false;
+                     dragRow = currentRow;
+                     dropIndex = -1;
+                     movedRow = false;
+
+                     Capture();
                   }
                   if(editData && editData.visible && style.alwaysEdit)
                   {
@@ -3613,24 +3726,24 @@ private:
 
                      for(field = fields.first; field; field = field.next)
                      {
-                        int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ? 
+                        int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
                            clientSize.w - field.x : (field.width + EXTRA_SPACE);
 
                         if(!field.prev) width -= indent;
                         if(x >= sx && x < sx + width)
-                           break;                     
+                           break;
                         sx += width;
                      }
                      if(field == currentField)
                         editData.Deactivate();
                      else
                      {
-                        currentRow.Edit(field);                     
+                        currentRow.Edit(field);
                         editData.Activate();
                      }
                   }
                   else if(!(mods.ctrl) && numSelected <= 1)
-                     this.editRow = currentRow;
+                     editRow = currentRow;
 
                   if(style.noDragging && newCurrentRow)
                     NotifyReclick(master, this, newCurrentRow, mods);
@@ -3641,14 +3754,12 @@ private:
                   // activate it
                   if(editData && editData.visible && newCurrentRow)
                   {
-                     DataField field, whichField;
+                     DataField field;
                      int sx = -scroll.x;
                      int indent = 0;
 
                      if(style.collapse && !(style.treeBranch))
                         sx += 15;
-                  
-                     whichField = currentField;
 
                      {
                         DataRow parent;
@@ -3660,7 +3771,7 @@ private:
 
                      for(field = fields.first; field; field = field.next)
                      {
-                        int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ? 
+                        int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
                            clientSize.w - field.x : (field.width + EXTRA_SPACE);
                         if(!field.prev) width -= indent;
                         if(x >= sx && x < sx + width && newCurrentRow)
@@ -3685,8 +3796,7 @@ private:
          }
          else
          {
-            result = NotifySelect(master, this, 
-               currentRow ? currentRow : null, mods);
+            DataField f = null;
             if(result && style.alwaysEdit && currentRow)
             {
                if(newCurrentRow)
@@ -3706,19 +3816,25 @@ private:
 
                   for(field = fields.first; field; field = field.next)
                   {
-                     int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ? 
+                     int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
                         clientSize.w - field.x : (field.width + EXTRA_SPACE);
 
                      if(!field.prev) width -= indent;
                      if(x >= sx && x < sx + width)
                      {
-                        currentField = field;
+                        f = currentField = field;
                         break;
                      }
                      sx += width;
                   }
                }
-               currentRow.Edit(currentField);
+            }
+            // Moved NotifySelect after setting currentField for the NotifySelect implementation to be aware of which field is now selected (e.g. WatchesView)
+            result = NotifySelect(master, this, currentRow, mods);
+            if(result && style.alwaysEdit && currentRow)
+            {
+               // In case the user specifically clicked on a field (f is set), override any change to currentField that NotifySelect could have done
+               currentRow.Edit(f ? f : currentField);
 
                // If the user clicked exactly on the edited field,
                // activate it
@@ -3754,16 +3870,16 @@ private:
       {
          if(!style.noDragging)
          {
-            this.dragging = true;
+            dragging = true;
             Capture();
          }
          if(x >= 0 && y >= 0 && x < clientSize.w && y < clientSize.h)
-            this.rolledOver = true;
+            rolledOver = true;
          Update(null);
       }
       else
       {
-         this.dragging = false;
+         dragging = false;
          OnLeftButtonUp(x, y, mods);
       }
       return result;
@@ -3787,30 +3903,31 @@ private:
       {
          DataRow row, switchRow = rows.last;
          int rowY = (style.header) ? rowHeight : 0;
+         while(switchRow.lastRow) switchRow = switchRow.lastRow;
          for(row = firstRowShown; row; row = row.GetNextRow())
          {
             rowY += rowHeight;
-            if(rowY > y) 
+            if(rowY > y)
             {
                switchRow = row;
                break;
             }
          }
-         if(this.editRow == switchRow && y >= 0)
+         if(editRow == switchRow && y >= 0)
          {
             // Find which field
             DataField field;
             int fieldX = 0;
             for(field = fields.first; field; field = field.next)
             {
-               int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ? 
+               int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
                   clientSize.w - field.x : (field.width + EXTRA_SPACE);
                fieldX += width;
 
-               if(fieldX > x + scroll.x) 
+               if(fieldX > x + scroll.x)
                   break;
             }
-            
+
             if(field && field.editable)
             {
                // true: destroy edit box
@@ -3822,9 +3939,9 @@ private:
          }
          else if(style.moveRows && switchRow)
          {
-            if(this.dragRow == switchRow && this.movedRow == false)
+            if(dragRow == switchRow && movedRow == false)
             {
-               DataRow row = this.dragRow;
+               DataRow row = dragRow;
                DataRow selRow;
                if(!(mods.ctrl))
                {
@@ -3853,7 +3970,7 @@ private:
                clickedRow = row;
             }
             else
-            { 
+            {
                if(style.multiSelect)
                {
                   if(!switchRow.selectedFlag)
@@ -3888,25 +4005,57 @@ private:
                {
                   for(row = rows.first; row; row = row.GetNextRow())
                   {
-                     if(row == switchRow || row == this.dragRow)
+                     if(row == switchRow || row == dragRow)
                         break;
                   }
 
                   // Switch row first: move before
                   if(row == switchRow)
                   {
-                     if(NotifyMove(master, this, switchRow.prev, mods))
-                        dragRow.Move(switchRow.prev);
+                     DataRow actualMoveRow;
+
+                     if(!switchRow.prev && switchRow.parent == dragRow.parent)
+                        actualMoveRow = null;
+                     else
+                     {
+                        actualMoveRow = switchRow.prev ? switchRow.prev : switchRow;
+                        while(actualMoveRow && actualMoveRow.parent != dragRow.parent && actualMoveRow.parent)
+                           actualMoveRow = actualMoveRow.parent;
+                     }
+
+                     if(!actualMoveRow || (actualMoveRow && actualMoveRow.parent == dragRow.parent))
+                        if(NotifyMove(master, this, actualMoveRow, mods))
+                        {
+                           dragRow.Move(actualMoveRow);
+                           NotifyMoved(master, this, actualMoveRow, mods);
+                        }
                   }
                   // Dragged row first: move after
                   else
                   {
-                     if(NotifyMove(master, this, switchRow, mods))
-                        dragRow.Move(switchRow);
+                     DataRow actualMoveRow = switchRow;
+                     DataRow nextRow = switchRow.GetNextRow();
+
+                     while(nextRow && nextRow.parent != dragRow.parent)
+                        nextRow = nextRow.parent ? nextRow.parent.next : null;
+                     if(nextRow)
+                        actualMoveRow = nextRow.prev;
+
+                     if(!nextRow)
+                        actualMoveRow = dragRow.parent ? dragRow.parent.subRows.last : rows.last;
+
+                     if(!actualMoveRow || (actualMoveRow != dragRow && actualMoveRow.parent == dragRow.parent))
+                        if(NotifyMove(master, this, actualMoveRow, mods))
+                        {
+                           dragRow.Move(actualMoveRow);
+                           NotifyMoved(master, this, actualMoveRow, mods);
+                        }
                   }
                }
             }
          }
+         if(dragRow)
+            ReleaseCapture();
          dragRow = null;
          editRow = null;
          movedRow = false;
@@ -3915,11 +4064,11 @@ private:
       }
 
       timer.Stop();
-      if(this.dragging || style.freeSelect)
+      if(dragging || style.freeSelect)
       {
-         if(this.dragging)
+         if(dragging)
          {
-            this.rolledOver = this.dragging = false;
+            rolledOver = dragging = false;
          }
          if(x >= 0 && y >= 0 && x < clientSize.w && y < clientSize.h && currentRow && style.freeSelect)
          {
@@ -3958,7 +4107,7 @@ private:
       for(row = firstRowShown; row; row = row.GetNextRow())
       {
          rowY += rowHeight;
-         if(rowY > y || (style.multiSelect && !row.GetNextRow())) 
+         if(rowY > y || (style.multiSelect && !row.GetNextRow()))
          {
             if(style.treeBranch)
             {
@@ -4021,13 +4170,13 @@ private:
             bool looped = false;
             if(len == 1 && currentRow)
                startRow = (next = startRow.GetNextRow(), (next ? next : rows.first));
-        
+
             for(row = startRow; row != startRow || !looped; next = row.GetNextRow(), row = next ? next : rows.first)
             {
                void * data = row.GetData(field);
                char tempString[1024] = "";
                bool needClass = false;
-               char * string = data ? ((char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, data, tempString, null, &needClass) : null;
+               const char * string = data ? ((const char *(*)(void *, void *, char *, void *, bool *))(void *)field.dataType._vTbl[__ecereVMethodID_class_OnGetString])(field.dataType, data, tempString, null, &needClass) : null;
 
                if(string && string[0])
                   checkNextField = false;
@@ -4036,16 +4185,10 @@ private:
                   if(style.multiSelect)
                   {
                      DataRow selRow;
-                     bool foundRow = false;
 
-                     //this.clickedRowIndex = 0;
                      clickedRow = row;
                      for(selRow = rows.first; selRow; selRow = selRow.GetNextRow())
-                     {
-                        if(selRow == row) foundRow = true;
                         selRow.selectedFlag = unselected;
-                        //if(!foundRow) this.clickedRowIndex++;
-                     }
                      row.selectedFlag = selected;
                   }
                   SetCurrentRow(row, true);
@@ -4055,9 +4198,9 @@ private:
                looped = true;
             }
             typingTimer.Stop();
-            if(this.typingTimeOut && !keyHit)
+            if(typingTimeOut && !keyHit)
                typingTimer.Start();
-            if(!result || !this.typingTimeOut || keyHit)
+            if(!result || !typingTimeOut || keyHit)
                typedString[len-1] = '\0';
          }
          if(!checkNextField || result) break;
@@ -4079,7 +4222,7 @@ private:
       }
       else if(key == escape)
       {
-         if(resizingField || this.movingFields || (editData && editData.visible) || this.dragRow)
+         if(resizingField || movingFields || (editData && editData.visible) || dragRow)
          {
             if(editData && editData.visible && style.alwaysEdit && !editData.active)
                return true;
@@ -4087,26 +4230,29 @@ private:
             HideEditBox(false, false, false);
             if(resizingField)
             {
-               resizingField.width = this.startWidth;
+               resizingField.width = startWidth;
                AdaptToFieldWidth(resizingField, true);
                resizingField = null;
                ReleaseCapture();
             }
-            this.dragRow = null;
-            if(this.dragging)
+            if(dragRow)
+               ReleaseCapture();
+
+            dragRow = null;
+            if(dragging)
             {
-               this.dragging = false;
+               dragging = false;
                ReleaseCapture();
             }
 
-            this.movingFields = false;
+            movingFields = false;
             draggingField = null;
             Update(null);
             return false;
-         }      
+         }
       }
 
-      if(!currentField || !currentField.editable)            
+      if(!currentField || !currentField.editable)
          for(field = fields.first; field; field = field.next)
          {
             if(field.editable)
@@ -4115,17 +4261,28 @@ private:
                break;
             }
          }
-      if(key == f2 && currentField && currentField.editable)
+      if((key == f2 || (style.alwaysEdit && (key == ctrlV || key == ctrlC || key == ctrlX || key == shiftInsert || key == ctrlInsert || key == shiftDel))) &&
+            currentField && currentField.editable)
       {
          PopupEditBox(currentField, false);
          if(editData && editData.visible)
          {
             if(style.alwaysEdit)
+            {
                editData.Activate();
+               if(key == ctrlV || key == ctrlC || key == ctrlX || key == shiftInsert || key == ctrlInsert || key == shiftDel)
+               {
+                  editData.OnKeyHit(key, ch);
+                  StopEditing(true);
+               }
+               else
+                  // For Installer to pop up file dialog
+                  NotifyKeyDown(master, this, currentRow, key, ch);
+            }
             return false;
          }
       }
+
       if(!NotifyKeyDown(master, this, currentRow, key, ch))
          return false;
 
@@ -4136,7 +4293,7 @@ private:
             return editData.OnKeyDown(key, ch);
          return true;   // We want to pick up the OnKeyHit to replace contents, but skip GoToLetter
       }
-      
+
       if(ch >=32 && ch != 128 && !key.alt && !key.ctrl && GoToLetter(ch, false))
       {
          /*if(inactive && window.state != Hidden)
@@ -4183,7 +4340,7 @@ private:
          }
       }
 
-      if(editData && editData.visible && ch && !key.alt && !key.ctrl && editData.active)
+      if(editData && editData.visible && ch && !key.alt && !key.ctrl && editData.active && (key.code != tab || (editData._class == class(EditBox) && ((EditBox)editData).tabKey)))
          return false;
 
       if(!key.alt && (style.multiSelect || !key.ctrl))
@@ -4478,7 +4635,7 @@ private:
    int rowCount;
    int rowHeight;
    int fontH;
-   double typingTimeOut;
+   public double typingTimeOut;
    char * typedString;
 
    int mouseX, mouseY;
@@ -4504,7 +4661,7 @@ private:
    {
       delay = 0.5; // typingTimeOut
       userData = this;
-      
+
       bool DelayExpired()
       {
          typedString[0] = '\0';
@@ -4543,6 +4700,6 @@ private:
 
    // Only used for OnMouseMove so far, for avoiding problems with consequential mouse moves
    bool insideNotifySelect;
-   Color selectionColor, selectionText, stippleColor;
+   ColorAlpha selectionColor, selectionText, stippleColor;
    stippleColor = 0xFFFFFF80;
 };