On Wednesday, 18 April 2018 at 01:12:33 UTC, Chris Katko wrote:
My only questions are:
[snip]
How's about this one:
import std.stdio : writefln;
struct data_to_access_t
{
int tacos;
}
class Abc(T, alias Fn) {
T data;
this(T data) {
this.data = data;
}
void
On Wednesday, 18 April 2018 at 01:58:40 UTC, arturg wrote:
is it this what you want?
class A
{
int a;
void delegate() onDraw;
this(void delegate() dg)
{
onDraw = dg;
}
void drawText(string s)
{
s.writeln;
}
On Wednesday, 18 April 2018 at 01:12:33 UTC, Chris Katko wrote:
That was all pseudo-code typed by hand.
I got my code to work today. I don't know if it's the prettiest
it can be, but it works:
// TESTING ACCESS TO the OWNING function
//---
class
That was all pseudo-code typed by hand.
I got my code to work today. I don't know if it's the prettiest
it can be, but it works:
// TESTING ACCESS TO the OWNING function
//---
class test_window
{
float x;
float y;
On Tuesday, 17 April 2018 at 03:55:55 UTC, Chris Katko wrote:
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
On Tuesday, 17 April 2018 at 03:55:55 UTC, Chris Katko wrote:
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
On Tuesday, 17 April 2018 at 04:09:57 UTC, Chris Katko wrote:
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.
Can you post the code you're trying to run?
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
Some typos in there.
execute == on_draw.
Basically, I'm just sending a delegate/lambda "custom function"
at initialization time. But I'd like that delegate to somehow
access the holding classes functions. Or figure out how to do
that.
Maybe the class somehow sends the delegate a this
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)
10 matches
Mail list logo