Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Colored text

    SDK Help
    0
    3
    328
    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

      On 10/09/2016 at 10:53, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R18 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hello.

      I want to create a console-like dialog and I was wondering if you can have colored text.
      In general, can you have colored Strings anywhere (red, orange e.t.c)?
      Is there any example ?

      Thank you.

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

        On 10/09/2016 at 14:41, xxxxxxxx wrote:

        GeDialog  Example:

        //This is how to set the various color options in an EditText gizmo  
          
          GroupBegin(0,BFH_LEFT,2,0,"MyTextGroup",0);  
          {                  
            AddEditText(1001, BFH_SCALEFIT,400,15,0);  
            SetDefaultColor(1001, COLOR_TEXT_EDIT, Vector(1,0,0));      //Sets the color of the text  
            SetDefaultColor(1001, COLOR_TEXTFOCUS, Vector(0,1,0));      //Sets the color of the cursor line when typing text  
            SetDefaultColor(1001, COLOR_BGSELECTEDTEXT, Vector(0,0,1)); //Sets the color of the background(only the text bg) when text is selected(highlighted)  
            SetDefaultColor(1001, COLOR_FGSELECTEDTEXT, Vector(0,0,0)); //Sets the color of the text (only the text bg) when it's selected(highlighted)  
            SetDefaultColor(1001, COLOR_TRANS, Vector(0,0,0));          //Sets the background color behind the text(normally it's transparent)  
          }  
          GroupEnd();
        

        -ScottA

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

          On 12/09/2016 at 01:59, xxxxxxxx wrote:

          Hello,

          as Scott shows you can define the colors used by default GeDialog gadgets using SetDefaultColor(). This way you could use default gadets to build your dialog.

          But if you want something like the build-in console you might want to create you own gadget. Such a gadget is based on GeUserArea. So if you want to draw multiple lines with different colors you might want to use a GeClipMap to draw such a bitmap. Then you can use GeUserArea::DrawBitmap() to draw the result BaseBitmap inside GeUserArea::DrawMsg(). You find an example on how to use a GeUserArea in the customdata_customgui.cpp example.

          best wishes,
          Sebastian

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