[glom] List: Really store data when the primary key is not auto-incremented.



commit 8db60a5c1320d5f04953c6abbf6a56262db7bca1
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Dec 19 00:39:28 2011 +0100

    List: Really store data when the primary key is not auto-incremented.
    
    * glom/mode_data/db_adddel/db_adddel.cc: user_added(): Do not use
    get_value_key_selected() to get the entered field data, because that
    is only useful after the key has been entered. Instead get the
    entered data from the cell where it was entered.

 ChangeLog                             |    9 +++++++++
 glom/mode_data/db_adddel/db_adddel.cc |    8 +++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5c479d9..59bed75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-12-19  Murray Cumming  <murrayc murrayc com>
+
+	List: Really store data when the primary key is not auto-incremented.
+
+	* glom/mode_data/db_adddel/db_adddel.cc: user_added(): Do not use 
+	get_value_key_selected() to get the entered field data, because that 
+	is only useful after the key has been entered. Instead get the 
+	entered data from the cell where it was entered.
+
 2011-12-18  Murray Cumming  <murrayc murrayc com>
 
 	PostgreSQL: Print stderr message when the connection fails completely.
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index bc93920..4b41419 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -2297,10 +2297,12 @@ void DbAddDel::user_added(const Gtk::TreeModel::iterator& row)
     //Use the user-entered primary key value:
 
     //This only works when the primary key is already stored: primary_key_value = get_value_key(row);
-    //sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
-    //layout_item->set_full_field_details(field);
+    //primary_key_value = get_value_key_selected();
 
-    primary_key_value = get_value_key_selected();
+    sharedptr<LayoutItem_Field> layout_field = sharedptr<LayoutItem_Field>::create();
+    layout_field->set_full_field_details(primary_key_field);
+    primary_key_value = get_value_selected(layout_field);
+    std::cout << "DEBUG: get_value_key_selected(): " << primary_key_value.to_string() << std::endl;
   }
 
   //If no primary key value is available yet, then don't add the record yet:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]