Basp
Topic Author
Posts: 22
Joined: 08 May 2014, 10:09

[Unity] Adding controls to a canvas programmatically

13 May 2014, 16:46

I'm trying to add some controls to a Canvas element programmatically. In other XAML based frameworks, I'd simply create the control and add it to the Canvas's Children, like so:
var button = new Button();
myCanvas.Children.Add(button);
However, this does not appear to work in Noesis GUI. The Canvas control doesn't expose a Children property. Is there any other way to add items programmatically?
 
User avatar
sfernandez
Site Admin
Posts: 2337
Joined: 22 Dec 2011, 19:20

Re: [Unity] Adding controls to a canvas programmatically

13 May 2014, 17:21

Current Unity API exposes most of the functionality via methods, so to access the Children collection of a Panel you should call GetChildren():
var button = new Button();
myCanvas.GetChildren().Add(button);
We want to change this for 1.2 version, providing C# properties to access element properties, trying to follow WPF API as much as we can.
 
Basp
Topic Author
Posts: 22
Joined: 08 May 2014, 10:09

Re: [Unity] Adding controls to a canvas programmatically

03 Jun 2014, 16:17

Thanks for the response! Any news on when 1.2 is out?
 
User avatar
sfernandez
Site Admin
Posts: 2337
Joined: 22 Dec 2011, 19:20

Re: [Unity] Adding controls to a canvas programmatically

06 Jun 2014, 02:16

We are working hard because we are a bit late according to our planning.
I can't set an official date, but it will be soon.

Who is online

Users browsing this forum: Google [Bot] and 0 guests