[MonoTouch] Monotouch dialog help needed.

Nic Wise nicw at fastchicken.co.nz
Mon Oct 31 11:44:24 EDT 2011


BTW, the code you posted is the same as:

RootElement root = new RootElement("Settings");

var sec = new Section();

var brightnessRoot = new RootElement("Brightness");
var sec2 = new Section();
var floatElement = new FloatElement(null, null, 0.5f);
sec2.Add(floatElement);
brightnessRoot.Add(sec2);

sec.Add(brightnessRoot);

root.Add(sec);

But you can also do this:

var floatElement = new FloatElement (null, null, 0.5f);
var anotherElement = new StringElement("Oh Hai!");

RootElement root = new RootElement ("Settings") {
	new Section (){
		new RootElement ("Brightness"){
			new Section (){
				floatElement,
				anotherElement
				new FloatElement(null, null, 0.6f)
			}
		}
	}
} ;
			

or any combination. You are just building an object graph up :)



On Mon, Oct 31, 2011 at 15:40, Nic Wise <nicw at fastchicken.co.nz> wrote:
> Keep a reference to the FloatElement :)
>
> outside the method:
> FloatElement floatElement;
>
> in the method you build the root with:
>
> floatElement = new FloatElement(null, null, 0.5f);
>
>> new RootElement ("Brightness"){
>>
>> new Section (){
>>
>> floatElement <---- not the new FloatElement(etc)
>>
>> }
>>
>> }
>
> then, somewhere else:
>
> float foo = floatElement.Value;
>
> (might be .FloatValue, and you MIGHT need to call .FetchValue first! not sure)
>
>
> I sometimes keep sections around, too, if I need to change them at
> runtime (hide, show, add items etc). Seldom keep Root's around, as I
> can usually get them easily.
>
>
> On Mon, Oct 31, 2011 at 15:14, Mittchel Van Vliet <mittchel at gmail.com> wrote:
>> Hello everyone,
>> Currently I am checking out MonoTouch Dialog and found some interesting
>> things.. Though there is one problem that keeps persisting with me.
>> How am I able to extract the value of a specific item? For example I got a
>> FloatElement:
>>
>> RootElement root = new RootElement ("Settings") {
>>
>> new Section (){
>>
>> new RootElement ("Brightness"){
>>
>> new Section (){
>>
>> new FloatElement (null, null, 0.5f)
>>
>> }
>>
>> }
>>
>> }
>>
>> } ;
>>
>> My initial idea was to make it a slider for a kilometer range.. but how am I
>> able to extract the selected data from the slider?
>> I hope someone can help me with this :)
>> Thanks!
>> _______________________________________________
>> MonoTouch mailing list
>> MonoTouch at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/monotouch
>>
>>
>
>
>
> --
> Nic Wise
> t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
> b. http://www.fastchicken.co.nz/
>
> Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
> mobileAgent (for FreeAgent): get your accounts in your pocket.
> http://goo.gl/IuBU
> Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
> London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
>



-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2


More information about the MonoTouch mailing list