StrataFrame Forum

InfoBox.NotifyBoxSettings - How to use it correctly

http://forum.strataframe.net/Topic32047.aspx

By Marcelo Blank - 5/6/2013

Hi..

I Have a InfoBox.NotifyBoxSettings, that I call in another thread of the app.

It is a stock trade screen, full of settings during all the time, with a lot of combos and other components ...

The problem is that when the InfoBox.NotifyBoxSettings appers, and I ´m editing or with a combo open (selecting a broker...) it closes it and get the value of the combo, that was in a selection process...

How can I avoid this behavior ?

Regards,
By Ivan George Borges - 5/6/2013

Hi Marcelo.

Don't know how you coded the other thread and maybe a sample application would help. But have you tried using a BackgroundWorker to show your InfoBox on its ProgressChanged event?
By StrataFrame Team - 5/7/2013

You would need to use a System.Threading.ManualResetEvent to prevent the other thread from showing the InfoBox.  Both threads would need a reference to it, so put it somewhere (static field or something) where they can both see it.  Create it with True in the constructor so it starts already signaled; that way, if you never open the combo box, the InfoBox isn't blocked.  Then, in the DropDownOpened (or whatever the event is, I can't remember), call .Reset() on the ManualResetEvent, and when the drop down closes or when you're ready to allow the InfoBox to show, call .Set() on it.  Lastly, in the thread that shows the InfoBox, call .WaitOne() on the ManualResetEvent right before the InfoBox is shown.  This will cause that other thread to block until the combo box closes and you call .Set() on the main thread.
By Marcelo Blank - 5/7/2013

Thank you for a roadmap ...

I will try it.

Regards,