I'm having trouble conceptualizing this issue at the moment. But it seems if I pass to the delegate my object, then I can ONLY use one class type.

Say, the delegate takes a "this" from... some class that wants to have a dialog. A window. Now the delegate NEEDS a this from a window, and only a window. So if I have a delegate in... something else, I'll either need to figure out some way for templates to work with that... or some kind of wrapping class / interface.

But all I want is a kind of Javascript'y:

Every time this object gets .onDraw() called. It does whatever I told it to do.

auto t = new object1( onDraw(){ do stuff} );
auto t2 = new object2( onDraw() { do other stuff} );

I'm trying to do the same kind of API for button handling where it automatically links into event queues (which works) and the button does whatever I want it to. But, it can only access PUBLIC INTERFACES (globals) because it can't access the underlying object and globals are the only ones it can statically figure out at compile-time.

Reply via email to