UserArea Problem



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

    On 26/04/2010 at 02:04, xxxxxxxx wrote:

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

    ---------
    I have added a bitmap suscesfully. But when moving or resizing the dialog , while draging it for some seconds the bitmap DISAPEARS (!?) ... is any why to refresh the bitmap or something so it comes back ? or any way so this bug doesnt happens?

    Image showing the bitmap gone:



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

    On 26/04/2010 at 03:16, xxxxxxxx wrote:

    Please post your bitmap code showing the problem.

    cheers,
    Matthias



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

    On 26/04/2010 at 03:32, xxxxxxxx wrote:

    Thanks, here some parts of the code:

    BitmapGUI::Draw(x1, y1, x2, y2)
    {
      DrawBitmap(bitmap, 0, 0, GetUserWidth() - 1, GetUserHeight() - 1, x1, y1, x2, y2, BMP_NORMALSCALED);
      return (TRUE);
    }

    AddBitmap(id, dialog, name, flags, x, y)
    {
      dialog->AddUserArea(id, flags, x, y);
      new(BitmapGUI, id, dialog, name);
    }

    MyDialog::CreateLayout()
    {
    SetTitle(PLUGIN_NAME);    AddBitmap(MY_BITMAP2, this, "header.png", BFH_CENTER, 0, 0);
    return (TRUE);
    }



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

    On 26/04/2010 at 03:58, xxxxxxxx wrote:

    Does this solve the problem?

      
    BitmapGUI::Draw(x1, y1, x2, y2)  
    {  
      //to avoid blinking/flickering  
      OffScreenOn();  
      SetClippingRegion(x1,y1,x2,y2);  
      
      DrawBitmap(bitmap, 0, 0, GetUserWidth() - 1, GetUserHeight() - 1, x1, y1, x2, y2, BMP_NORMALSCALED);  
      return (TRUE);  
    }  
    

    cheers,
    Matthias



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

    On 26/04/2010 at 04:12, xxxxxxxx wrote:

    I tried that code but same, after some seconds of resizing the windows with button pressed the bitmap just disapears, very weird. :(



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

    On 26/04/2010 at 04:29, xxxxxxxx wrote:

    Note I just realized:
    If i add a button to add another bitmap
    then when i have the bitmap disapearing problem, i execute that code, then I maximize the dialog and the bitmap appears again...Only maximizing it, not while resizing.
    That helps to spot the problem?



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

    On 26/04/2010 at 07:55, xxxxxxxx wrote:

    I don't normally use AddUserArea() because I prefer to use resource files, but with res files you have to use AttachUserArea() to add a user area object to the dialog. Do you have to do the same after adding one in code?



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

    On 26/04/2010 at 08:25, xxxxxxxx wrote:

    I only use the AddUserArea and the DrawBitmap , i have no idea how is with res files yet.

    Is there a way to update/refresh the dialog? I notice it only refresh/updates when maximinzing, not while dragin/resizing. That can be a start to try to fix the problem.



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

    On 27/04/2010 at 08:02, xxxxxxxx wrote:

    I am not able to confirm the problem.

    Here is my test code, it'a simple dialog with a scalable bitmap user area.

      
    // be sure to use a unique ID obtained from www.plugincafe.com  
    var PLUGIN_ID = 910000;  
    // be sure to use a unique ID obtained from www.plugincafe.com  
      
    // global variables  
    var bmp;  
    var text;  
      
    // definition of my user area  
    class MyUserArea : GeUserArea  
    {  
      public:  
          MyUserArea(id,dialog);  
          Init();  
          GetUserWidth();  
          GetUserHeight();  
      
          Draw(x1,y1,x2,y2);  
    }  
      
    MyUserArea::MyUserArea(id,dialog)  
    {  
      super(id,dialog);  
    }  
      
    MyUserArea::Init()  
    {  
    }  
      
    MyUserArea::GetUserWidth()  
    {  
      return 128;  
    }  
      
    MyUserArea::GetUserHeight()  
    {  
      return 128;  
    }  
      
    MyUserArea::Draw(x1,y1,x2,y2)  
    {  
      OffScreenOn();  
      SetClippingRegion(x1,y1,x2,y2);  
        
      DrawBitmap(bmp, 0, 0, 127, 127, x1, y1, x2, y2, BMP_NORMALSCALED);  
      
    }  
      
      
    // definition of my Dialog class  
    class MyDialog : GeDialog  
    {  
      private:  
          var ua;  
      
      public:  
          MyDialog();  
      
          CreateLayout();  
          Init();  
          Command(id,msg);  
    }  
      
    MyDialog::MyDialog()  
    {  
      super(PLUGIN_ID);  
      ua=NULL;  
    }  
      
    MyDialog::CreateLayout()  
    {  
      SetTitle("My Dialog");  
      
      AddUserArea(5000,BFH_SCALEFIT|BFV_SCALEFIT,0,0);  
      
      ua = new(MyUserArea,5000,this);  
      
      return TRUE;  
    }  
      
    MyDialog::Init()  
    {  
    }  
      
    MyDialog::Command(id,msg)  
    {  
    //    switch (id)  
      {  
      }  
    }  
      
      
    class MyMenuPlugin : MenuPlugin  
    {  
      public:  
          MyMenuPlugin();  
      
          GetID();  
          GetName();  
          GetHelp();  
          Execute(doc);  
      
          RestoreLayout(secret,subid);  
    }  
      
    MyMenuPlugin::MyMenuPlugin()  
    {  
      super();  
    }  
      
    MyMenuPlugin::GetID()  
    {  
      return PLUGIN_ID;  
    }  
      
    MyMenuPlugin::GetName()  
    {  
      return "My Dialog";  
    }  
      
    MyMenuPlugin::GetHelp()  
    {  
      return "Shows programming of bitmap area";  
    }  
      
    var d;  
      
    MyMenuPlugin::Execute(doc)  
    {  
      d->Open(TRUE,-1,-1);  
    }  
      
    MyMenuPlugin::RestoreLayout(secret,subid)  
    {  
      if (!d) d = new(MyDialog);  
      d->RestoreLayout(secret);  
    }  
      
      
    main()  
    {  
      d = new(MyDialog);  
        
      if (!bmp) bmp = new(BaseBitmap, 128, 128);  
      var fn = new(Filename);  
      fn->SetFullString("c:\\testbitmap.tif");  
        
      bmp->Load(fn);  
        
      Register(MyMenuPlugin);  
    }  
    

    cheers,
    Matthias



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

    On 29/04/2010 at 01:54, xxxxxxxx wrote:

    Hi Matthias, Your code worked without problems. I love you.
    Thanks a lot Sir!


Log in to reply