[MonoTouch] MT.Dialog: RadioElements Weird When Added from Task/Thread

2012-09-25 Thread Phil Cockfield
Here is an AppDelegate that contains an example of the problem I'm finding
with MT.Dialog and radio elements.

https://gist.github.com/3780834


This is just a *DialogViewController *that contains 3 *RadioElement*'s.

The problem is that when the radio-elements are added via a background
thread/task, which then marshals back onto the UI thread, the
radio-elements turn up in the table in a selected state (the tick is
visible) and they do no respond to tap events, or change state on tap.

  // FAILS: Add some items on a background thread.
  //  All items will be selected, and won't recieve click events.
  Task.Factory.StartNew(() = {
BeginInvokeOnMainThread(() = addRadios(3));
  });


Can anyone see what is going on here.  This seems to be related to calling
back in from the background thread to update the UI.  Is there something
I'm missing in how to do this safely?

Thanks!

-- 
*Phil *Cockfield
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


Re: [MonoTouch] MT.Dialog: RadioElements Weird When Added from Task/Thread

2012-09-25 Thread Nic Wise
What happens if you tell the root to reload after you add?

or use insert, rather than add?

On Tue, Sep 25, 2012 at 10:33 AM, Phil Cockfield p...@cockfield.net wrote:

 Here is an AppDelegate that contains an example of the problem I'm finding
 with MT.Dialog and radio elements.

 https://gist.github.com/3780834


 This is just a *DialogViewController *that contains 3 *RadioElement*'s.

 The problem is that when the radio-elements are added via a background
 thread/task, which then marshals back onto the UI thread, the
 radio-elements turn up in the table in a selected state (the tick is
 visible) and they do no respond to tap events, or change state on tap.

   // FAILS: Add some items on a background thread.

   //  All items will be selected, and won't recieve click events.

   Task.Factory.StartNew(() = {
 BeginInvokeOnMainThread(() = addRadios(3));
   });


 Can anyone see what is going on here.  This seems to be related to calling
 back in from the background thread to update the UI.  Is there something
 I'm missing in how to do this safely?

 Thanks!

 --
 *Phil *Cockfield




 ___
 MonoTouch mailing list
 MonoTouch@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/

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
Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop.
http://goo.gl/Vcz1p
London Bike App: Find the nearest Boris Bike, and get riding!
http://goo.gl/Icp2
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


Re: [MonoTouch] MT.Dialog: RadioElements Weird When Added from Task/Thread

2012-09-25 Thread Nic Wise
Not that I've found. There is an Insert (or add?) that takes an
IEnumerable, but I'm not sure that'll do what you want either :)

On Tue, Sep 25, 2012 at 7:01 PM, Phil Cockfield p...@cockfield.net wrote:

 Thanks *Nic*!

 *ReloadData()* on the DVC does the trick.  I get a flash from this all
 selected state to the correct state after the reload occurs.

 I wonder if there's a way to silently insert elements into the DVC's *
 section*, then force the reload.



 On Wed, Sep 26, 2012 at 12:47 AM, Nic Wise n...@fastchicken.co.nz wrote:

 What happens if you tell the root to reload after you add?

 or use insert, rather than add?

 On Tue, Sep 25, 2012 at 10:33 AM, Phil Cockfield p...@cockfield.netwrote:

 Here is an AppDelegate that contains an example of the problem I'm
 finding with MT.Dialog and radio elements.

 https://gist.github.com/3780834


 This is just a *DialogViewController *that contains 3 *RadioElement*'s.

 The problem is that when the radio-elements are added via a background
 thread/task, which then marshals back onto the UI thread, the
 radio-elements turn up in the table in a selected state (the tick is
 visible) and they do no respond to tap events, or change state on tap.



   // FAILS: Add some items on a background thread.



   //  All items will be selected, and won't recieve click events.



   Task.Factory.StartNew(() = {


 BeginInvokeOnMainThread(() = addRadios(3));


   });


 Can anyone see what is going on here.  This seems to be related to
 calling back in from the background thread to update the UI.  Is there
 something I'm missing in how to do this safely?

 Thanks!

 --
 *Phil *Cockfield




 ___
 MonoTouch mailing list
 MonoTouch@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/

 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
 Earnest: Self-employed? Track your business expenses and income.
 http://earnestapp.com
 Nearest Bus: find when the next bus is coming to your stop.
 http://goo.gl/Vcz1p
 London Bike App: Find the nearest Boris Bike, and get riding!
 http://goo.gl/Icp2




 --
 *Phil *Cockfield






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

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
Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop.
http://goo.gl/Vcz1p
London Bike App: Find the nearest Boris Bike, and get riding!
http://goo.gl/Icp2
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch