Dialog in script - Bitmap/ButtonBitmap possible?



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

    On 29/03/2010 at 06:34, xxxxxxxx wrote:

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

    ---------
    1)
    I have a script that makes a dialog,
    AddStaticText(0,BFH_SCALEFIT,0,0,"Set name:",0);
    AddEditText(0,BFH_CENTER,400,11);
    etc...

    Its posible to add a bitmap (a logo) or a bitmapbutton ? in the script an as easy way as that ?

    Another question (not related to previus topic) :
    Lets say a dialog have a add and remove button to remove or add items in a combobox or list, is that posible? and it automatically updates de list of items or we have to reload the dialog or something?...

    Thanks



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

    On 29/03/2010 at 12:06, xxxxxxxx wrote:

    As far as I know, there's no direct possibility to add a bitmap to a GeUserDialog in Coffee. But you could use the member function AddUserArea() to add a GeUserArea. The GeUserArea class offers the member function DrawBitmap(), which should do what you want.  
    Cheers,
    Jack



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

    On 29/03/2010 at 16:16, xxxxxxxx wrote:

    Any example please?



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

    On 30/03/2010 at 01:09, xxxxxxxx wrote:

    Sorry, I code in C++.
    No Coffee examples from me ;-) 
    Anyone else?
    Cheers,
    Jack



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

    On 30/03/2010 at 08:38, xxxxxxxx wrote:

    Sorry if this question is too silly but:
    Is not posible to put c++ code inside a coffe script?



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

    On 30/03/2010 at 10:35, xxxxxxxx wrote:

    Of course not. Otherwise it would be called a C++ script.
    Cheers,
    Frank



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

    On 30/03/2010 at 14:02, xxxxxxxx wrote:

    or maybe a Zoffee script.. :D sorry, couldn´t resist.

    For examples, search the forum. You will have enough information and example code to create a user area.

    Generally you should first have a look at basic programming operations in a procedural or object oriented language. It will save you time and head aches.



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

    On 31/03/2010 at 05:12, xxxxxxxx wrote:

    Yes, bitmaps or bitmap buttons are realized through user areas in dialogs.

    Here is a simple example showing the basic use of user areas. It's just a pure red bitmap but you can use the BaseBitmap loading methods to load a custom bitmap.

      
    class MyUserArea : GeUserArea  
    {  
      public:  
          MyUserArea(id,dialog);  
          Init();  
          GetUserWidth();  
          GetUserHeight();  
          Draw(x1,y1,x2,y2);  
      
      private:  
          var bmp;  
    }  
      
    MyUserArea::MyUserArea(id,dialog)  
    {  
      super(id,dialog);  
    }  
      
    MyUserArea::Init()  
    {  
      var x = GetUserWidth();  
      var y = GetUserHeight();  
      
      bmp = new(BaseBitmap,x,y);  
      
      bmp->SetPen(vector(1.0,0.0,0.0));  
      
      bmp->DrawRect(0,0,x-1,y-1);  
    }  
      
    MyUserArea::GetUserWidth()  
    {  
      return 200;  
    }  
      
    MyUserArea::GetUserHeight()  
    {  
      return 200;  
    }  
      
    MyUserArea::Draw(x1,y1,x2,y2)  
    {  
      OffScreenOn();  
      SetClippingRegion(x1,y1,x2,y2);  
      
      DrawBitmap(bmp,0,0,199,199,x1,y1,x2,y2,BMP_NORMAL);  
    }  
      
      
    class MyDialog : GeModalDialog  
    {  
      public:  
          MyDialog();  
          CreateLayout();  
      
      private:  
          var ua;  
    }  
      
    MyDialog::MyDialog()  
    {  
      super();  
    }  
      
    MyDialog::CreateLayout()   
    {  
      SetTitle("My Dialog");  
      
      AddUserArea(5000,BFH_FIT|BFH_FIT,0,0);  
      
      ua = new(MyUserArea,5000,this);  
      
      return;  
    }  
      
      
    main(doc,op)  
    {  
      var d = new(MyDialog);  
      d->Open(-1, -1);  
    }  
    

    Please check the COFFEE documentation for explainations of the classes.

    cheers,
    Matthias


Log in to reply