Re: [Vala] An array of Delegations?



That's just a missing access modifier.  Add "public" before the "delegate"
keyword on the first line and it should compile.

-- Jim

On Wed, Jun 1, 2011 at 9:23 PM, Joseph Montanez <jmontanez gorilla3d com>wrote:

Jim,

I had tried that too and get the hole " is less accessible than field"

On Wed, Jun 1, 2011 at 5:22 PM, Jim Nelson <jim yorba org> wrote:
Try wrapping the delegates in an object and storing those in Gee or an
array.  The class accepting the delegates could use a private class so
it's
not exposed.

delegate void UserCallback();

public class CallbackManager {
  private class DelegateWrapper {
    public UserCallback cb;
  }

  private DelegateWrapper[] ar = new DelegateWrapper[0];

  public void add_callback(UserCallback cb) {
    DelegateWrapper wrapper = new DelegateWrapper();
    wrapper.cb = cb;
    ar += wrapper;
  }
}

(This is just off the top of my head, I didn't compile this to verify.)

-- Jim

On Wed, Jun 1, 2011 at 4:20 PM, Joseph Montanez <jmontanez gorilla3d com

wrote:

I know this is a bit insane, but is there any plan or maybe even a
work around to having working list of delegations? I tried with both
gee and fixed arrays for delegations but I get the error of:

"Delegates with target are not supported as array element type"

Right now my only work around is have a number of nullable single
delegates in a class then keeping track of the last assigned index.

--
Joseph Montanez
Web Developer
Gorilla3D
Design, Develop, Deploy
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list





--
Joseph Montanez
Web Developer
Gorilla3D
Design, Develop, Deploy



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]