Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: monkey0506 on Sun 23/08/2009 06:01:31

Title: SUGGESTION: Autocomplete should detect inherited extenders.
Post by: monkey0506 on Sun 23/08/2009 06:01:31
I've been adding some custom extender methods onto the GUIControl type (for all GUIControl types) and I've noticed something. It seems that autocomplete doesn't detect the inheritance of extender methods. I could use the extender methods just fine, but they refused to show up in autocomplete. I even tried the fake-import-in-a-comment trick to no avail.

What I've had to do is actually overload the extender functions for each of the inherited types like:

void SetProperty(this Button*, int value) {
 GUIControl *gc = this;
 gc.SetProperty(value);
}

int GetProperty(this Button*) {
 GUIControl *gc = this;
 return gc.GetProperty();
}


My tests proved that the overloaded versions of the functions were actually getting called as well (which is actually interesting...::)).

However I'm just saying it would be nice if autocomplete could be made to detect the inheritance of my extender methods? Nothing high priority by any means though.

Edit: I corrected the overloaded functions to reflect I am calling the GUIControl method not the overloaded methods recursively... ::)

Edit 2: Somehow I completely failed to recognize at first that the fact that the overloaded functions were getting called is polymorphism (http://www.americangirlscouts.org/agswiki/Extender_Methods_mean_Polymorphism!). Which is nice. Please don't fix that Chris. :P
Title: Re: SUGGESTION: Autocomplete should detect inherited extenders.
Post by: Wonkyth on Tue 25/08/2009 13:13:09
I'd like this as well, as I have enough trouble with spelling errors as it is.
Title: Re: SUGGESTION: Autocomplete should detect inherited extenders.
Post by: Pumaman on Mon 31/08/2009 19:24:39
Hmm interesting, I'll look into this.