User Area Image

On 16/12/2013 at 12:36, xxxxxxxx wrote:

I want to add a user area with an image to a dialogue like this:

  
GROUP_ID1=1000  
USERAREA=1010  
  
class Dialog1(gui.GeDialog) :  
  
  class DialogUserArea(c4d.gui.GeUserArea) :  
      def GetMinSize(self) :  
         self.width = 200  
         self.height = 50  
         return (self.width, self.height)   
  
      def DrawMsg(self, x1, y1, x2, y2, msg) :  
          bmp = c4d.bitmaps.BaseBitmap()  
          dir, file = os.path.split(__file__)  
          path = os.path.join(dir, "res", "test.tif")  
          result = bmp.InitWith(path)  
          result, ismovie = bmp.InitWith(path)  
          if result == c4d.IMAGERESULT_OK:  
              print("load ok!")  
              self.DrawBitmap(bmp, 0, 0, bmp.GetBw(), bmp.GetBh(), 0, 0, bmp.GetBw(), bmp.GetBh(), c4d.BMP_NORMALSCALED)  
  
      def Redraw(self) :  
          bmp = c4d.bitmaps.BaseBitmap()  
          dir, file = os.path.split(__file__)  
          path = os.path.join(dir, "res", "test.tif")  
          result = bmp.InitWith(path)  
          result, ismovie = bmp.InitWith(path)  
          if result == c4d.IMAGERESULT_OK:  
              print("load ok!")  
              self.DrawBitmap(bmp, 0, 0, bmp.GetBw(), bmp.GetBh(), 0, 0, bmp.GetBw(), bmp.GetBh(), c4d.BMP_NORMALSCALED)  
  
  def CreateLayout(self) :  
      self.GroupBegin(GROUP_ID1, c4d.BFH_LEFT, 1, 1)  
      self.AddUserArea(USERAREA, flags = c4d.BFH_LEFT, initw=200, inith=50)  
      self.GroupEnd()  
      ua = Dialog1.DialogUserArea()  
      self.AttachUserArea(ua, USERAREA)  
      self.LayoutChanged(GROUP_ID1)  
      ua.Redraw()  
      print XXXXXX # provoke error  
      return True  
        
class do_command(c4d.plugins.CommandData) :  
    
  def Execute(self, doc) :  
      menu = Dialog1()  
      menu.Open(c4d.DLG_TYPE_MODAL, defaultw=215, defaulth=100)  
      return True  

If I provoke an error message in create layout like print XXXXX the image is there, if CreateLayout returns True there is no image!?
Probably something stupid, it´s the first time I work with user areas.

Edited Topic Title

On 17/12/2013 at 04:38, xxxxxxxx wrote:

Don´t worry, used a Custom Gui Bitmapbutton for that.