« FileMaker DevCon 2013… | Home | MBS Real Studio Plugi… »

Thread GUI Access


You may have read that accessing GUI elements in a thread is a bad idea. In the Real Software blog have been articles like Doing Progress Right and Detecting UI Access from Threads.
But well I don't like this thing with running a timer to update GUI. I want to update the GUI from the thread. There even was somewhere a feature request to make some methods like progressbar.value working well on a thread.
As this is still missing and setting progressbar.value on a thread still makes trouble, I added a few utility methods to our plugins:
  • Label.SetTextThreadSafeMBS
  • Progressbar.SetMaximumThreadSafeMBS
  • Progressbar.SetMinimumThreadSafeMBS
  • Progressbar.SetValueThreadSafeMBS
  • RectControl.SetEnabledThreadSafeMBS
  • RectControl.SetVisibleThreadSafeMBS
I hope those help people to move their code more easier to Cocoa, make it work right and thread safe.
16 12 12 - 21:15
seven comments

Thanks Christian. I haven’t begun to move my apps to Cocoa but have been reading about this GUI problem. For me the bigger problem is I update cells or create rows for listboxes from threads. Is it possible to add some thread safe methods for a listbox? And while we are at it the text of a TextField and TextArea?

Mark
Mark (Email) - 16 12 12 - 21:56

Sure. Just email me what you need exactly.
Christian Schmitz (URL) - 16 12 12 - 21:59

Hallelujah.

I agree with the sentiment even if I don’t need these functions
Gerard (Email) - 17 12 12 - 08:55

Will this be for Windows as well? (I guess I can check the docs…)
Mattias Sandström - 17 12 12 - 13:14

The functions are cross platform.
Christian Schmitz (URL) - 17 12 12 - 13:27

When will they be available?
Jon - 17 12 12 - 19:07

The only problem I have occasionally is to show a message dialog during a thread. In some cases the dialog shows up after something is completed and not before. This affects mostly database operations like re-indexing. Would it be possible to get a thread-safe message dialog what shows up immediately?
Beatrix Willius (Email) - 18 12 12 - 08:35


  
Remember personal info?

Emoticons / Textile


Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.