changeset 2941:7a057db0bd36

C++: Fix Container signals on GTK by moving the signal setup... from the constructor to the Setup() function. Be sure to pack the Container or Filesystem widget before calling Setup().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 01 Jan 2023 05:50:08 +0000
parents 60e90b783cb1
children 63d7baebb0d4
files dw.hpp
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dw.hpp	Sun Jan 01 01:14:55 2023 +0000
+++ b/dw.hpp	Sun Jan 01 05:50:08 2023 +0000
@@ -1646,12 +1646,16 @@
 {
 public:
     // Constructors
-    Container(unsigned long id, int multi) { SetHWND(dw_container_new(id, multi)); SetupObjectView(); SetupContainer(); }
-    Container(int multi) { SetHWND(dw_container_new(0, multi)); SetupObjectView(); SetupContainer(); }
-    Container() { SetHWND(dw_container_new(0, FALSE)); SetupObjectView(); SetupContainer(); }
+    Container(unsigned long id, int multi) { SetHWND(dw_container_new(id, multi)); }
+    Container(int multi) { SetHWND(dw_container_new(0, multi)); }
+    Container() { SetHWND(dw_container_new(0, FALSE)); }
 
     // User functions
-    int Setup(unsigned long *flags, const char *titles[], int count, int separator) { return dw_container_setup(hwnd, flags, (char **)titles, count, separator); }    
+    int Setup(unsigned long *flags, const char *titles[], int count, int separator) {
+      int retval = dw_container_setup(hwnd, flags, (char **)titles, count, separator);
+      SetupObjectView(); SetupContainer();
+      return retval;
+    }    
     void ChangeItem(int column, int row, void *data) { dw_container_change_item(hwnd, column, row, data); }
     int GetColumnType(int column) { return dw_container_get_column_type(hwnd, column); }
     void SetItem(int column, int row, void *data) { dw_container_set_item(hwnd, allocpointer, column, row, data); }
@@ -1666,7 +1670,11 @@
     Filesystem() { SetHWND(dw_container_new(0, FALSE)); SetupObjectView(); SetupContainer(); }
 
     // User functions
-    int Setup(unsigned long *flags, const char *titles[], int count) { return dw_filesystem_setup(hwnd, flags, (char **)titles, count); }    
+    int Setup(unsigned long *flags, const char *titles[], int count) { 
+      int retval = dw_filesystem_setup(hwnd, flags, (char **)titles, count);
+      SetupObjectView(); SetupContainer();
+      return retval;
+    }    
     void ChangeFile(int row, const char *filename, HICN icon) { dw_filesystem_change_file(hwnd, row, filename, icon); }
     void ChangeItem(int column, int row, void *data) { dw_filesystem_change_item(hwnd, column, row, data); }
     int GetColumnType(int column) { return dw_filesystem_get_column_type(hwnd, column); }