ecere/DataBox: Tweaks for read only DataBoxes to not create DropBoxes when readOnly...
authorJerome St-Louis <jerome@ecere.com>
Tue, 31 Jul 2012 19:39:38 +0000 (15:39 -0400)
committerJerome St-Louis <jerome@ecere.com>
Tue, 31 Jul 2012 19:39:38 +0000 (15:39 -0400)
ecere/src/gui/controls/DataBox.ec
ecere/src/gui/typeEdit.ec
eda/libeda/locale/EDA.pot
ide/locale/ide.pot

index 1141236..72c6837 100644 (file)
@@ -98,6 +98,8 @@ private:
 
    bool OnPostCreate()
    {
+      // Right now for read-only DataBoxes the only reason we'd want to create an editor is for autoSize purposes, when using the default EditBox editor that supports it.
+      // ( A tweak for enum classes is in typeEdit.ec, as the base class editor invokes it )
       if(type && (!readOnly || (autoSize && type._vTbl[__ecereVMethodID_class_OnEdit] == class(Instance)._vTbl[__ecereVMethodID_class_OnEdit])) &&
          (type.type == normalClass || type.type == noHeadClass || data))
       {
@@ -134,7 +136,7 @@ private:
 
    void OnRedraw(Surface surface)
    {
-      if(type && !editor)
+      if(type && (!editor || !editor.created))
       {
          char tempString[1024];
          if(type._vTbl[__ecereVMethodID_class_OnDisplay] == class(Instance)._vTbl[__ecereVMethodID_class_OnDisplay])
index 46855bf..bd5e808 100644 (file)
@@ -58,15 +58,20 @@ private:
          return true;
       }
    };
-   dropBox.AddField({ dataType = _class, userData = userData });
-   dropBox.Create();
-
-   for(item = enumeration.values.first; item; item = item.next)
+   // Read only DataBoxes don't really need the edition, but it will be invoked if autoSize is on because the base class OnEdit check succeeded and chained here,
+   // and it's thinking the editor is going to be an EditBox. We return an editor so the DataBox goes on with life.
+   if(!((DataBox)window).readOnly)
    {
-      DataRow row = dropBox.AddRow();
-      row.SetData(null, (uint)item.data); //name);
-      if(data && (int)item.data == *data)
-         dropBox.currentRow = row;
+      dropBox.AddField({ dataType = _class, userData = userData });
+      dropBox.Create();
+
+      for(item = enumeration.values.first; item; item = item.next)
+      {
+         DataRow row = dropBox.AddRow();
+         row.SetData(null, (uint)item.data); //name);
+         if(data && (int)item.data == *data)
+            dropBox.currentRow = row;
+      }
    }
    return dropBox;
 }
index 4bdb83e..aaaa345 100644 (file)
@@ -14,17 +14,17 @@ msgstr ""
 msgid "(Click to add a new %s...)"
 msgstr "(Click to add a new %s...)"
 
-#: ./src/ers.ec:519
+#: ./src/ers.ec:517
 msgid "All files"
 msgstr "All files"
 
-#: ./src/ers.ec:30
+#: ./src/ers.ec:28
 #: ./src/gui.ec:20
 #: ./src/gui.ec:30
 msgid "Arial"
 msgstr "Arial"
 
-#: ./src/ers.ec:516
+#: ./src/ers.ec:514
 msgid "Comma Separated Values Spreadsheet (*.csv)"
 msgstr "Comma Separated Values Spreadsheet (*.csv)"
 
@@ -48,6 +48,10 @@ msgstr "Entry"
 msgid "Error reading field"
 msgstr "Error reading field"
 
+#: ./src/ers.ec:570
+msgid "Export as Spreadsheet (CSV)"
+msgstr "Export as Spreadsheet (CSV)"
+
 #: ./src/EDB.ec:234
 msgid "Invalid, corrupted or in use (%s) database file.\n"
 msgstr "Invalid, corrupted or in use (%s) database file.\n"
@@ -70,7 +74,7 @@ msgstr "New"
 msgid "New|id="
 msgstr "New|id="
 
-#: ./src/ers.ec:17
+#: ./src/ers.ec:15
 msgid "Please wait while the report is being generated..."
 msgstr "Please wait while the report is being generated..."
 
index ffa56ca..dc7af93 100644 (file)
@@ -280,8 +280,8 @@ msgstr "Arrange Icons"
 msgid "Attach"
 msgstr "Attach"
 
-#: ./src/designer/CodeEditor.ec:5152
-#: ./src/designer/CodeEditor.ec:5193
+#: ./src/designer/CodeEditor.ec:5153
+#: ./src/designer/CodeEditor.ec:5194
 msgid "Attach %s"
 msgstr "Attach %s"
 
@@ -385,7 +385,7 @@ msgstr "Call Stack"
 #: ./src/dialogs/NewProjectDialog.ec:208
 #: ./src/dialogs/NewProjectDialog.ec:526
 #: ./src/dialogs/ProjectActiveConfig.ec:57
-#: ./src/designer/CodeEditor.ec:5224
+#: ./src/designer/CodeEditor.ec:5225
 #: ./src/ProjectSettings.ec:172
 msgid "Cancel"
 msgstr "Cancel"
@@ -1088,8 +1088,8 @@ msgstr "Memory can't be read at %s"
 msgid "MemoryGuard"
 msgstr "MemoryGuard"
 
-#: ./src/designer/CodeEditor.ec:5153
-#: ./src/designer/CodeEditor.ec:5195
+#: ./src/designer/CodeEditor.ec:5154
+#: ./src/designer/CodeEditor.ec:5196
 msgid "Method is unused. Move method inside instance?"
 msgstr "Method is unused. Move method inside instance?"
 
@@ -1149,7 +1149,7 @@ msgstr "Name"
 msgid "Name Conflict"
 msgstr "Name Conflict"
 
-#: ./src/designer/CodeEditor.ec:5220
+#: ./src/designer/CodeEditor.ec:5221
 msgid "Name detached method"
 msgstr "Name detached method"
 
@@ -1233,7 +1233,7 @@ msgstr "Number of parallel build jobs"
 #: ./src/dialogs/NewProjectDialog.ec:34
 #: ./src/dialogs/NewProjectDialog.ec:345
 #: ./src/dialogs/ProjectActiveConfig.ec:39
-#: ./src/designer/CodeEditor.ec:5229
+#: ./src/designer/CodeEditor.ec:5230
 #: ./src/about.ec:34
 #: ./src/ProjectSettings.ec:211
 msgid "OK"