What I want:

class viewport_t
  {
  int x,y,w,h;
  }

class dialog_t
  {
  int x,y;

  this( int x, int y, delegate void (viewport_t) on_draw )
    {
    this.x = x;
    this.y = y;
    this.execute = execute;
    }

  void draw_text(string text)
    {
    }

  delegate void (viewport_t) on_draw;
  }

void function()
  {
  viewport_t v;
  dialog_t (15, 15,
        delegate void (viewport_t)
          {
          draw_text("hello world"); //calls dialog_t function
          }
        )
  }

Is this possible? Pass to a class, the code to run. But the code has to somehow know about the class methods.

I don't think you can pass "dialog_t.this" as it's being constructed!

Reply via email to