Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Implementing a list box

    SDK Help
    0
    5
    333
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 23/02/2005 at 04:34, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:    
      Platform:      
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      I'm still wondering in my quest for including a list view inside a dialog, using COFFEE, of course.
      What I want is a simple list of strings with a vertical scroll bar on the right.
      It has to be able to detect what string was clicked and should be able to be created dynamically (as in, adding new strings or recreating the while list).
      Anyone wants to join forces to create such a thing?
      Or, is there already any way to do it?

      Rui Batista

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 23/02/2005 at 05:10, xxxxxxxx wrote:

        Ok, I have a user area defined by Resedit, in a resource dialog.
        How do I add it a ScrollGroup? I know I must do it in COFFEE, not with Resedit. But, how to add a ScrollGroup to a User Area that is already defined as a resource?

        Rui Batista

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 23/02/2005 at 10:33, xxxxxxxx wrote:

          I may be out of my area here, but I don't think that's possible. Now you know why I create my dialogs programmatically within CreateLayout() and do not use dialog resources. ;0)

          Here's the code of my quick scrollgroup with buttons. Maybe it will help you, maybe not. Note that LayoutLVGroup() should be called whenever you want to update the list display.

            
          ////////////////////////////////////////////////////////////////  
          // lvdialog.coh  
          ////////////////////////////////////////////////////////////////  
            
          enum  
          {  
               ID_START = 4000,  
               ID_LVSGROUP,  
               ID_LVGROUP,  
               ID_LVITEMBASE = 5000  
          }  
            
          // CLASS: List View Dialog  
          class LVDialog : GeDialog  
          {  
               private:  
                    var a;  
               public:  
                    LVDialog();  
                    CreateLayout();  
                    LayoutLVGroup();  
                    CreateLVGroup();  
                    Init();  
                    Message(msg);  
                    Command(id, msg);  
                    Initialize();  
          }  
          // Constructor  
          LVDialog::LVDialog()  
          {  
               super(PLUGIN_MENU_ID);  
               a = new(array,10);  
               a[0] = "Item 1";  
               a[1] = "Item 2";  
               a[2] = "Item 3";  
               a[3] = "Item 4";  
               a[4] = "Item 5";  
               a[5] = "Item 6";  
               a[6] = "Item 7";  
               a[7] = "Item 8";  
               a[8] = "Item 9";  
               a[9] = "Item 10";  
          }  
          // Layout Dialog GUI  
          LVDialog::CreateLayout()  
          {  
               SetTitle(resource->GetString(PLUGIN_MENU_TEXT)+" v"+resource->GetString(PLUGIN_MENU_VERSION));  
               AddGroupBeginV(4000,BFH_SCALEFIT|BFV_SCALEFIT,1,"",0);  
               {  
                    AddGroupBorderSpace(4,4,4,4);  
                    AddGroupSpace(4,4);  
                    AddScrollGroupBegin(ID_LVSGROUP, BFH_CENTER|BFV_SCALEFIT, SCROLLGROUP_VERT|SCROLLGROUP_HORIZ|SCROLLGROUP_AUTOVERT|SCROLLGROUP_AUTOHORIZ);  
                    {  
                         AddGroupBorder(BORDER_IN);  
                         AddGroupBeginV(ID_LVGROUP,BFH_SCALEFIT|BFV_SCALEFIT,1,"",0);  
                         {  
                              CreateLVGroup();  
                         }  
                         AddGroupEnd();  
                    }  
                    AddScrollGroupEnd();  
               }  
               AddGroupEnd();  
               return TRUE;  
          }  
          // Relayout LV Group  
          LVDialog::LayoutLVGroup()  
          {  
               LayoutFlushGroup(ID_LVGROUP);  
               CreateLVGroup();  
               LayoutChanged(ID_LVGROUP);  
          }  
          // Create ListView Group of Buttons  
          LVDialog::CreateLVGroup()  
          {  
               var x;  
               for (x = 0; x < 10; x++)  
               {  
                    AddButton(ID_LVITEMBASE+i,BFH_LEFT|BFV_CENTER,0,0,a[x]);  
               }  
          }  
          LVDialog::Init()  
          {  
          }  
          LVDialog::Message(msg)  
          {  
               return super::Message(msg);  
          }  
          LVDialog::Command(id, msg)  
          {  
               if (id >= ID_LVITEMBASE)  
               {  
                    println("Selected: ",id);  
               }  
          }  
          
          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 24/02/2005 at 06:33, xxxxxxxx wrote:

            I decided to go "the hard" way and try to code my layout in COFFEE. But, another problem showed his uggly head:
            I have to have a way to re-create my list whenever I want. So, if I code the dialog in COFFEE, I have to set the list at the beginning. But then, when I want to update it, how can I do it? I can't re-generate the dialog again and again. In your code, you already know you want 10 buttons. I may have 10 items in the list at first, but then after a while, when I refresh it, I may have more or less items.
            So, how to do it?!?

            Rui Batista

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 24/02/2005 at 08:41, xxxxxxxx wrote:

              In C++, I use simple "linked list" classes (head/tail in a 'parent' class) :

              class SomeItem
              {
                 class SomeItem *prev, *next;
                 ...
              };

              With this, I can insert, append, remove, and then update.

              COFFEE doesn't have 'pointers', so this is a problem. If you know that your list isn't going to be very large, you could allocate an array, like I did, but to some maximum size. Then keep a counter of items. This makes removal and insertion fun though - you will need to shuffle the array elements for these operations. Better to make a 'list' class containing the array to encapsulate all of the operations.

              Or you could derive your item class from BaseList2D and get all of that functionality (at a size cost assuredly).

              1 Reply Last reply Reply Quote 0
              • First post
                Last post