changeset 2930:d8117d36ed27

C++: Add Page 4 - Container to dwtestoo. Had to rename ListBoxes G/SetText() to G/SetListText(). Since TextEntry has the same names but with different signatures. Thought it should be able to differentiate, but it errored as ambiguous. Also make ListSelect unsigned int since it should never be negative.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 30 Dec 2022 12:15:19 +0000
parents 2ab97b349958
children 30c1f37713b6
files dw.hpp dwtestoo.cpp
diffstat 2 files changed, 371 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/dw.hpp	Fri Dec 30 09:35:00 2022 +0000
+++ b/dw.hpp	Fri Dec 30 12:15:19 2022 +0000
@@ -577,8 +577,8 @@
     Calendar() { SetHWND(dw_calendar_new(0)); }
 
     // User functions
-    void GetData(unsigned int *year, unsigned int *month, unsigned int *day) { dw_calendar_get_date(hwnd, year, month, day); }
-    void SetData(unsigned int year, unsigned int month, unsigned int day) { dw_calendar_set_date(hwnd, year, month, day); }
+    void GetDate(unsigned int *year, unsigned int *month, unsigned int *day) { dw_calendar_get_date(hwnd, year, month, day); }
+    void SetDate(unsigned int year, unsigned int month, unsigned int day) { dw_calendar_set_date(hwnd, year, month, day); }
 };
 
 
@@ -1114,9 +1114,9 @@
 private:
     bool ListSelectConnected;
 #ifdef DW_LAMBDA
-    std::function<int(int)> _ConnectListSelect;
+    std::function<int(unsigned int)> _ConnectListSelect;
 #endif
-    int (*_ConnectListSelectOld)(ListBoxes *, int index);
+    int (*_ConnectListSelectOld)(ListBoxes *, unsigned int index);
     void Setup() {
 #ifdef DW_LAMBDA
         _ConnectListSelect = 0;
@@ -1131,11 +1131,11 @@
         ListBoxes *classptr = reinterpret_cast<ListBoxes *>(data);
 #ifdef DW_LAMBDA
         if(classptr->_ConnectListSelect)
-            return classptr->_ConnectListSelect(index);
+            return classptr->_ConnectListSelect((unsigned int)index);
 #endif
         if(classptr->_ConnectListSelectOld)
-            return classptr->_ConnectListSelectOld(classptr, index);
-        return classptr->OnListSelect(index);
+            return classptr->_ConnectListSelectOld(classptr, (unsigned int)index);
+        return classptr->OnListSelect((unsigned int)index);
     }
 public:
     // User functions
@@ -1143,8 +1143,8 @@
     void Clear() { dw_listbox_clear(hwnd); }
     int Count() { return dw_listbox_count(hwnd); }
     void Delete(int index) { dw_listbox_delete(hwnd, index); }
-    void GetText(unsigned int index, char *buffer, unsigned int length) { dw_listbox_get_text(hwnd, index, buffer, length); }
-    void SetText(unsigned int index, char *buffer) { dw_listbox_set_text(hwnd, index, buffer); }
+    void GetListText(unsigned int index, char *buffer, unsigned int length) { dw_listbox_get_text(hwnd, index, buffer, length); }
+    void SetListText(unsigned int index, char *buffer) { dw_listbox_set_text(hwnd, index, buffer); }
     void Insert(const char *text, int pos) { dw_listbox_insert(hwnd, text, pos); }
     void ListAppend(char **text, int count) { dw_listbox_list_append(hwnd, text, count); }
     void Select(int index, int state) { dw_listbox_select(hwnd, index, state); }
@@ -1152,7 +1152,7 @@
     int Selected(int where) { return dw_listbox_selected_multi(hwnd, where); }
     void SetTop(int top) { dw_listbox_set_top(hwnd, top); }
 #ifdef DW_LAMBDA
-    void ConnectListSelect(std::function<int(int)> userfunc)
+    void ConnectListSelect(std::function<int(unsigned int)> userfunc)
     {
         _ConnectListSelect = userfunc;
         if(!ListSelectConnected) {
@@ -1161,7 +1161,7 @@
         }
     }    
 #endif
-    void ConnectListSelect(int (*userfunc)(ListBoxes *, int))
+    void ConnectListSelect(int (*userfunc)(ListBoxes *, unsigned int))
     {
         _ConnectListSelectOld = userfunc;
         if(!ListSelectConnected) {
@@ -1172,7 +1172,7 @@
 protected:
     // Our signal handler functions to be overriden...
     // If they are not overridden and an event is generated, remove the unused handler
-    virtual int OnListSelect(int index) {
+    virtual int OnListSelect(unsigned int index) {
         dw_signal_disconnect_by_name(hwnd, DW_SIGNAL_LIST_SELECT);
         ListSelectConnected = false;
         return FALSE;
@@ -1313,7 +1313,7 @@
     void Clear() { dw_mle_clear(hwnd); }
     void Delete(int startpoint, int length) { dw_mle_delete(hwnd, startpoint, length); }
     void Export(char *buffer, int startpoint, int length) { dw_mle_export(hwnd, buffer, startpoint, length); }
-    void Import(const char *buffer, int startpoint) { dw_mle_import(hwnd, buffer, startpoint); }
+    int Import(const char *buffer, int startpoint) { return dw_mle_import(hwnd, buffer, startpoint); }
     void GetSize(unsigned long *bytes, unsigned long *lines) { dw_mle_get_size(hwnd, bytes, lines); }
     void Search(const char *text, int point, unsigned long flags) { dw_mle_search(hwnd, text, point, flags); }
     void SetAutoComplete(int state) { dw_mle_set_auto_complete(hwnd, state); }
@@ -1321,6 +1321,8 @@
     void SetEditable(int state) { dw_mle_set_editable(hwnd, state); }
     void SetVisible(int line) { dw_mle_set_visible(hwnd, line); }
     void SetWordWrap(int state) { dw_mle_set_word_wrap(hwnd, state); }
+    int SetFont(const char *font) { return dw_window_set_font(hwnd, font); }
+    char *GetFont() { return dw_window_get_font(hwnd); }
 };
 
 class Notebook : public Widget
@@ -1504,20 +1506,20 @@
 private:
     bool ItemEnterConnected, ColumnClickConnected;
 #ifdef DW_LAMBDA
-    std::function<int(char *)> _ConnectItemEnter;
+    std::function<int(char *, void *)> _ConnectItemEnter;
     std::function<int(int)> _ConnectColumnClick;
 #endif
-    int (*_ConnectItemEnterOld)(Containers *, char *);
+    int (*_ConnectItemEnterOld)(Containers *, char *, void *);
     int (*_ConnectColumnClickOld)(Containers *, int);
-    static int _OnItemEnter(HWND window, char *text, void *data) {
+    static int _OnItemEnter(HWND window, char *text, void *data, void *itemdata) {
         Containers *classptr = reinterpret_cast<Containers *>(data);
 #ifdef DW_LAMBDA
         if(classptr->_ConnectItemEnter)
-            return classptr->_ConnectItemEnter(text);
+            return classptr->_ConnectItemEnter(text, itemdata);
 #endif
         if(classptr->_ConnectItemEnterOld)
-            return classptr->_ConnectItemEnterOld(classptr, text);
-        return classptr->OnItemEnter(text);
+            return classptr->_ConnectItemEnterOld(classptr, text, itemdata);
+        return classptr->OnItemEnter(text, itemdata);
     }
     static int _OnColumnClick(HWND window, int column, void *data) {
         Containers *classptr = reinterpret_cast<Containers *>(data);
@@ -1554,7 +1556,7 @@
     }
     // Our signal handler functions to be overriden...
     // If they are not overridden and an event is generated, remove the unused handler
-    virtual int OnItemEnter(char *text) {
+    virtual int OnItemEnter(char *text, void *itemdata) {
         dw_signal_disconnect_by_name(hwnd, DW_SIGNAL_ITEM_ENTER);
         ItemEnterConnected = false;
         return FALSE;
@@ -1585,7 +1587,7 @@
     void SetRowTitle(int row, const char *title) { dw_container_set_row_title(allocpointer, row, title); }
     void SetStripe(unsigned long oddcolor, unsigned long evencolor) { dw_container_set_stripe(hwnd, oddcolor, evencolor); }
 #ifdef DW_LAMBDA
-    void ConnectItemEnter(std::function<int(char *)> userfunc)
+    void ConnectItemEnter(std::function<int(char *, void *)> userfunc)
     {
         _ConnectItemEnter = userfunc;
         if(!ItemEnterConnected) {
@@ -1594,7 +1596,7 @@
         }
     }        
 #endif
-    void ConnectItemEnter(int (*userfunc)(Containers *, char *))
+    void ConnectItemEnter(int (*userfunc)(Containers *, char *, void *))
     {
         _ConnectItemEnterOld = userfunc;
         if(!ItemEnterConnected) {
@@ -1603,7 +1605,7 @@
         }
     }        
 #ifdef DW_LAMBDA
-    void ConnecColumnClick(std::function<int(int)> userfunc)
+    void ConnectColumnClick(std::function<int(int)> userfunc)
     {
         _ConnectColumnClick = userfunc;
         if(!ColumnClickConnected) {
@@ -1631,7 +1633,7 @@
     Container() { SetHWND(dw_container_new(0, FALSE)); SetupObjectView(); SetupContainer(); }
 
     // User functions
-    int Setup(unsigned long *flags, char **titles, int count, int separator) { return dw_container_setup(hwnd, flags, titles, count, separator); }    
+    int Setup(unsigned long *flags, const char *titles[], int count, int separator) { return dw_container_setup(hwnd, flags, (char **)titles, count, separator); }    
     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); }
@@ -1646,7 +1648,7 @@
     Filesystem() { SetHWND(dw_container_new(0, FALSE)); SetupObjectView(); SetupContainer(); }
 
     // User functions
-    int Setup(unsigned long *flags, char **titles, int count) { return dw_filesystem_setup(hwnd, flags, titles, count); }    
+    int Setup(unsigned long *flags, const char *titles[], int count) { return dw_filesystem_setup(hwnd, flags, (char **)titles, count); }    
     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); }
--- a/dwtestoo.cpp	Fri Dec 30 09:35:00 2022 +0000
+++ b/dwtestoo.cpp	Fri Dec 30 12:15:19 2022 +0000
@@ -391,6 +391,79 @@
         return menu;
     }
 
+    DW::ComboBox *ColorCombobox(void)
+    {
+        DW::ComboBox *combobox = new DW::ComboBox("DW_CLR_DEFAULT");
+
+        combobox->Append("DW_CLR_DEFAULT");
+        combobox->Append("DW_CLR_BLACK");
+        combobox->Append("DW_CLR_DARKRED");
+        combobox->Append("DW_CLR_DARKGREEN");
+        combobox->Append("DW_CLR_BROWN");
+        combobox->Append("DW_CLR_DARKBLUE");
+        combobox->Append("DW_CLR_DARKPINK");
+        combobox->Append("DW_CLR_DARKCYAN");
+        combobox->Append("DW_CLR_PALEGRAY");
+        combobox->Append("DW_CLR_DARKGRAY");
+        combobox->Append("DW_CLR_RED");
+        combobox->Append("DW_CLR_GREEN");
+        combobox->Append("DW_CLR_YELLOW");
+        combobox->Append("DW_CLR_BLUE");
+        combobox->Append("DW_CLR_PINK");
+        combobox->Append("DW_CLR_CYAN");
+        combobox->Append("DW_CLR_WHITE");
+        return combobox;
+    }
+
+    unsigned long ComboboxColor(const char *colortext)
+    {
+        unsigned long color = DW_CLR_DEFAULT;
+
+        if(strcmp(colortext, "DW_CLR_BLACK") == 0)
+            color = DW_CLR_BLACK;
+        else if(strcmp(colortext, "DW_CLR_DARKRED") == 0)
+            color = DW_CLR_DARKRED;
+        else if(strcmp(colortext, "DW_CLR_DARKGREEN") == 0)
+            color = DW_CLR_DARKGREEN;
+        else if(strcmp(colortext, "DW_CLR_BROWN") == 0)
+            color = DW_CLR_BROWN;
+        else if(strcmp(colortext, "DW_CLR_DARKBLUE") == 0)
+            color = DW_CLR_DARKBLUE;
+        else if(strcmp(colortext, "DW_CLR_DARKPINK") == 0)
+            color = DW_CLR_DARKPINK;
+        else if(strcmp(colortext, "DW_CLR_DARKCYAN") == 0)
+            color = DW_CLR_DARKCYAN;
+        else if(strcmp(colortext, "DW_CLR_PALEGRAY") == 0)
+            color = DW_CLR_PALEGRAY;
+        else if(strcmp(colortext, "DW_CLR_DARKGRAY") == 0)
+            color = DW_CLR_DARKGRAY;
+        else if(strcmp(colortext, "DW_CLR_RED") == 0)
+            color = DW_CLR_RED;
+        else if(strcmp(colortext, "DW_CLR_GREEN") == 0)
+            color = DW_CLR_GREEN;
+        else if(strcmp(colortext, "DW_CLR_YELLOW") == 0)
+            color = DW_CLR_YELLOW;
+        else if(strcmp(colortext, "DW_CLR_BLUE") == 0)
+            color = DW_CLR_BLUE;
+        else if(strcmp(colortext, "DW_CLR_PINK") == 0)
+            color = DW_CLR_PINK;
+        else if(strcmp(colortext, "DW_CLR_CYAN") == 0)
+            color = DW_CLR_CYAN;
+        else if(strcmp(colortext, "DW_CLR_WHITE") == 0)
+            color = DW_CLR_WHITE;
+
+        return color;
+    }
+
+    void MLESetFont(DW::MLE *mle, int fontsize, char *fontname)
+    {
+        char font[101] = {0};
+
+        if(fontname)
+            snprintf(font, 100, "%d.%s", fontsize, fontname);
+        mle->SetFont(fontname ? font : NULL);
+    }
+
     // Add the menus to the window
     void CreateMenus() {
         // Setup the menu
@@ -953,7 +1026,7 @@
             return TRUE;
         });
 
-        rendcombo->ConnectListSelect([this](int index) -> int 
+        rendcombo->ConnectListSelect([this](unsigned int index) -> int 
         {
             if(index != this->render_type)
             {
@@ -1018,7 +1091,7 @@
             {
                 char buf[201] = {0};
 
-                snprintf(buf, 200, "DW_SIGNAL_ITEM_SELECT:Item: %x Text: %s Item Data: %x", DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata));
+                snprintf(buf, 200, "DW_SIGNAL_ITEM_SELECT:Item: %x Text: %s Itemdata: %x", DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata));
                 tree_status->SetText(buf);
                 return FALSE;
             });
@@ -1045,6 +1118,268 @@
         }
     }
 
+    // Page 4 - Container
+    void CreateContainer(DW::Box *notebookbox)
+    {
+        char buffer[101] = {0};
+        CTIME time;
+        CDATE date;
+
+        // create a box to pack into the notebook page
+        DW::Box *containerbox = new DW::Box(DW_HORZ, 2);
+        notebookbox->PackStart(containerbox, 500, 200, TRUE, TRUE, 0);
+
+        // Add a word wrap checkbox
+        DW::Box *hbox = new DW::Box(DW_HORZ, 0);
+
+        DW::CheckBox *checkbox = new DW::CheckBox("Word wrap");
+        hbox->PackStart(checkbox,  FALSE, TRUE, 1);
+        DW::Text *text = new DW::Text("Foreground:");
+        text->SetStyle(DW_DT_VCENTER);
+        hbox->PackStart(text, FALSE, TRUE, 1);
+        DW::ComboBox *mlefore = ColorCombobox();
+        hbox->PackStart(mlefore, 150, DW_SIZE_AUTO, TRUE, FALSE, 1);
+        text = new DW::Text("Background:");
+        text->SetStyle(DW_DT_VCENTER);
+        hbox->PackStart(text, FALSE, TRUE, 1);
+        DW::ComboBox *mleback = ColorCombobox();
+        hbox->PackStart(mleback, 150, DW_SIZE_AUTO, TRUE, FALSE, 1);
+        checkbox->Set(TRUE);
+        text = new DW::Text("Font:");
+        text->SetStyle(DW_DT_VCENTER);
+        hbox->PackStart(text, FALSE, TRUE, 1);
+        DW::SpinButton *fontsize = new DW::SpinButton("9");
+        hbox->PackStart(fontsize, FALSE, FALSE, 1);
+        fontsize->SetLimits(100, 5);
+        fontsize->SetPos(9);
+        DW::ComboBox *fontname = new DW::ComboBox("Default");
+        fontname->Append("Default");
+        fontname->Append("Arial");
+        fontname->Append("Geneva");
+        fontname->Append("Verdana");
+        fontname->Append("Helvetica");
+        fontname->Append("DejaVu Sans");
+        fontname->Append("Times New Roman");
+        fontname->Append("Times New Roman Bold");
+        fontname->Append("Times New Roman Italic");
+        fontname->Append("Times New Roman Bold Italic");
+        hbox->PackStart(fontname, 150, DW_SIZE_AUTO, TRUE, FALSE, 1);
+        notebookbox->PackStart(hbox, TRUE, FALSE, 1);
+
+        // now a container area under this box
+        DW::Filesystem *container = new DW::Filesystem(TRUE);
+        notebookbox->PackStart(container, 500, 200, TRUE, FALSE, 1);
+
+        // and a status area to see whats going on
+        DW::StatusText *container_status = new DW::StatusText();
+        notebookbox->PackStart(container_status, 100, DW_SIZE_AUTO, TRUE, FALSE, 1);
+
+        const char *titles[] = { "Type", "Size", "Time", "Date" };
+        unsigned long flags[4] = {  DW_CFA_BITMAPORICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR,
+                                    DW_CFA_ULONG | DW_CFA_RIGHT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR,
+                                    DW_CFA_TIME | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR,
+                                    DW_CFA_DATE | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR };
+
+
+        container->SetColumnTitle("Test");
+        container->Setup(flags, titles, 4);
+        container->SetStripe(DW_CLR_DEFAULT, DW_CLR_DEFAULT);
+        container->Alloc(3);
+
+        for(int z=0;z<3;z++)
+        {
+            char names[101] = {0};
+            HICN thisicon = (z == 0 ? foldericon : fileicon);
+
+            snprintf(names, 100, "We can now allocate from the stack: Item: %d", z);
+            unsigned long size = z*100;
+            snprintf(buffer, 100, "Filename %d", z+1);
+            container->SetFile(z, buffer, thisicon);
+            container->SetItem(0, z, &thisicon);
+            container->SetItem(1, z, &size);
+
+            time.seconds = z+10;
+            time.minutes = z+10;
+            time.hours = z+10;
+            container->SetItem(2, z, &time);
+
+            date.day = z+10;
+            date.month = z+10;
+            date.year = z+2000;
+            container->SetItem(3, z, &date);
+
+            container->SetRowTitle(z, names);
+            container->SetRowData(z, DW_INT_TO_POINTER(z));
+        }
+
+        container->Insert();
+
+        container->Alloc(1);
+        container->SetFile(0, "Yikes", foldericon);
+        unsigned long size = 324;
+        container->SetItem(0, 0, &foldericon);
+        container->SetItem(1, 0, &size);
+        container->SetItem(2, 0, &time);
+        container->SetItem(3, 0, &date);
+        container->SetRowTitle(0, "Extra");
+
+        container->Insert();
+        container->Optimize();
+
+        DW::MLE *container_mle = new DW::MLE();
+        containerbox->PackStart(container_mle, 500, 200, TRUE, TRUE, 0);
+
+        mle_point = container_mle->Import("", -1);
+        snprintf(buffer, 100, "[%d]", mle_point);
+        mle_point = container_mle->Import(buffer, mle_point);
+        snprintf(buffer, 100, "[%d]abczxydefijkl", mle_point);
+        mle_point = container_mle->Import(buffer, mle_point);
+        container_mle->Delete(9, 3);
+        mle_point = container_mle->Import("gh", 12);
+        unsigned long newpoint;
+        container_mle->GetSize(&newpoint, NULL);
+        mle_point = (int)newpoint;
+        snprintf(buffer, 100, "[%d]\r\n\r\n", mle_point);
+        mle_point = container_mle->Import(buffer, mle_point);
+        container_mle->SetCursor(mle_point);
+
+        // connect our event trappers...
+        container->ConnectItemEnter([container_status](char *text, void *itemdata) -> int
+        {
+            char buf[201] = {0};
+
+            snprintf(buf, 200, "DW_SIGNAL_ITEM_ENTER: Text: %s Itemdata: %x", text, DW_POINTER_TO_UINT(itemdata));
+            container_status->SetText(buf);
+            return FALSE;
+        });
+
+        container->ConnectItemContext([this, container_status](char *text, int x, int y, void *itemdata) -> int
+        {
+            char buf[201] = {0};
+            DW::Menu *popupmenu = ItemContextMenu(container_status, "Item context menu clicked.");
+
+            snprintf(buf, 200, "DW_SIGNAL_ITEM_CONTEXT: Text: %s x: %d y: %d Itemdata: %x", text, x, y, DW_POINTER_TO_UINT(itemdata));
+            container_status->SetText(buf);
+            popupmenu->Popup(this, x, y);
+            return FALSE;
+        });
+
+        container->ConnectItemSelect([this, container_mle, container, container_status](HTREEITEM item, char *text, void *itemdata) -> int
+        {
+            char buf[201] = {0};
+
+            snprintf(buf, 200, "DW_SIGNAL_ITEM_SELECT:Item: %x Text: %s Itemdata: %x",
+                    DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata));
+            container_status->SetText(buf);
+            snprintf(buf, 200, "\r\nDW_SIGNAL_ITEM_SELECT: Item: %x Text: %s Itemdata: %x\r\n",
+                    DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata));
+            this->mle_point = container_mle->Import(buf, mle_point);
+            char *str = container->QueryStart(DW_CRA_SELECTED);
+            while(str)
+            {
+                snprintf(buf, 200, "Selected: %s\r\n", str);
+                mle_point = container_mle->Import(buf, mle_point);
+                this->app->Free(str);
+                str = container->QueryNext(DW_CRA_SELECTED);
+            }
+            // Make the last inserted point the cursor location
+            container_mle->SetCursor(mle_point);
+            // set the details of item 0 to new data
+            this->app->Debug("In cb: icon: %x\n", DW_POINTER_TO_INT(fileicon));
+            container->ChangeFile(0, "new data", fileicon);
+            unsigned long size = 999;
+            this->app->Debug("In cb: icon: %x\n",  DW_POINTER_TO_INT(fileicon));
+            container->ChangeItem(1, 0, &size);
+            return FALSE;
+        });
+
+        container->ConnectColumnClick([container, container_status](int column_num) -> int
+        {
+            const char *type_string = "Filename";
+
+            if(column_num != 0)
+            {
+                int column_type = container->GetColumnType(column_num-1);
+
+                if(column_type == DW_CFA_STRING)
+                    type_string = "String";
+                else if(column_type == DW_CFA_ULONG)
+                    type_string ="ULong";
+                else if(column_type == DW_CFA_DATE)
+                    type_string = "Date";
+                else if(column_type == DW_CFA_TIME)
+                    type_string ="Time";
+                else if(column_type == DW_CFA_BITMAPORICON)
+                    type_string = "BitmapOrIcon";
+                else
+                    type_string = "Unknown";
+            }
+            char buf[201] = {0};
+            snprintf(buf, 200, "DW_SIGNAL_COLUMN_CLICK: Column: %d Type: %s", column_num, type_string);
+            container_status->SetText(buf);
+            return FALSE;
+        });
+
+        mlefore->ConnectListSelect([this, mlefore, mleback, container_mle](unsigned int pos) -> int
+        {
+            char colortext[101] = {0};
+            ULONG fore = DW_CLR_DEFAULT, back = DW_CLR_DEFAULT;
+
+            mlefore->GetListText(pos, colortext, 100);
+            fore = ComboboxColor(colortext);
+            char *text = mleback->GetText();
+
+            if(text && *text)
+            {
+                back = ComboboxColor(text);
+                this->app->Free(text);
+            }
+            container_mle->SetColor(fore, back);
+            return FALSE;
+        });
+
+        mleback->ConnectListSelect([this, mlefore, mleback, container_mle](unsigned int pos) -> int
+        {
+            char colortext[101] = {0};
+            ULONG fore = DW_CLR_DEFAULT, back = DW_CLR_DEFAULT;
+
+            mleback->GetListText(pos, colortext, 100);
+            back = ComboboxColor(colortext);
+            char *text = mlefore->GetText();
+
+            if(text && *text)
+            {
+                fore = ComboboxColor(text);
+                this->app->Free(text);
+            }
+            container_mle->SetColor(fore, back);
+            return FALSE;
+        });
+
+        fontname->ConnectListSelect([this, fontname, fontsize, container_mle](unsigned int pos) -> int
+        {
+            char font[101] = {0};
+
+            fontname->GetListText(pos, font, 100);
+            MLESetFont(container_mle, (int)fontsize->GetPos(), strcmp(font, "Default") == 0 ? NULL : font);
+            return FALSE;
+        });
+
+        fontsize->ConnectValueChanged([this, fontname, container_mle](int size) -> int
+        {
+            char *font = fontname->GetText();
+
+            if(font)
+            {
+                MLESetFont(container_mle, size, strcmp(font, "Default") == 0 ? NULL : font);
+                this->app->Free(font);
+            }
+            else
+                MLESetFont(container_mle, size, NULL);
+            return FALSE;
+        });
+    }
+
 public:
     // Constructor creates the application
     DWTest(const char *title): DW::Window(title) {
@@ -1130,6 +1465,13 @@
         notebook->Pack(notebookpage, notebookbox);
         notebook->PageSetText(notebookpage, "tree");
 
+        // Create Notebook Page 4 - Container
+        notebookbox = new DW::Box(DW_VERT, 5);
+        CreateContainer(notebookbox);
+        notebookpage = notebook->PageNew();
+        notebook->Pack(notebookpage, notebookbox);
+        notebook->PageSetText(notebookpage, "container");
+
         // Finalize the window
         this->SetSize(640, 550);