2012/9/11 "Luis L. RodrÃguez Oro" <[email protected]> > Hi all, please help me. > > what is the best way to run the metho1 from the method2 of class2. I need > to change the interface from the class2. This example is illustrative only. > > Please help me. > > class main_window: Window{ > private Entry obj_entry; > private Class2 class2; > public main_window(){ > ... > obj_entry = ... as Entry; > } > > public method1(args...){ > ... > obj_entry.text = "ok"; > } > } > > class Clas2{ > .... > private method2(args....){ > } > } > > You want to call main_window::method1() from within Clas2::method2(), is that correct? Well, you cannot call non-static methods without an object, so you will need a reference to main_window within your Clas2 object to call method1() on. As this will setup a circular reference, you should declare it weak, as in
private weak main_window main_window_ref; in Clas2, then pass the "this" reference when you create your main_window object. Then you can call any public method on it from Clas2.
_______________________________________________ vala-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/vala-list
