Update listview from a background thread
my thread listens to the mails coming to outlook. i have a list in javafx stage which displays the inbox of my outlook. when i get a new mail it should appear in my listview also how to do that. pls help.
Updating a control that is currently visible must always be done from the JavaFX event thread. So, updating a control directly from a background thread will not work.
Hiowever, there is a function in the Platform class, Platform.runLater(), that allows you to submit a Runnable that will be executed on the JavaFX event thread as soon as possible. From this Runnable you can update your controls.
Platform.runLater(new Runnable() {
public void run() {
// do your updates here (no big calculatiions though as that would block the FX thread resulting in an unresponsive UI).
});
Similar Messages
-
Updating the GUI from a background Thread: Platform.Runlater() Vs Tasks
Hi Everyone,
Hereby I would like to ask if anyone can enlighten me on the best practice for concurency with JAVAFX2. More precisely, if one has to update a Gui from a background Thread what should be the appropriate approach.
I further explain my though:
I have window with a text box in it and i receive some message on my network on the background, hence i want to update the scrolling textbox of my window with the incoming message. In that scenario what is the best appraoch.
1- Shall i implement my my message receiver as thread in which i would then use a platform.RunLater() ?
2- Or shall i use a Task ? In that case, which public property of the task shall take the message that i receive ? Are property of the task only those already defined, or any public property defined in subclass can be used to be binded in the graphical thread ?
In general i would like to understand, what is the logic behind each method ?
My understanding here, is that task property are only meant to update the gui with respect to the status of the task. However updating the Gui about information of change that have occured on the data model, requires Platform.RunLater to be used.
Edited by: 987669 on Feb 12, 2013 12:12 PMShall i implement my my message receiver as thread in which i would then use a platform.RunLater() ?Yes.
Or shall i use a Task ?No.
what is the logic behind each method?A general rule of thumb:
a) If the operation is initiated by the client (e.g. fetch data from a server), use a Task for a one-off process (or a Service for a repeated process):
- the extra facilities of a Task such as easier implementation of thread safety, work done and message properties, etc. are usually needed in this case.
b) If the operation is initiated by the server (e.g. push data to the client), use Platform.runLater:
- spin up a standard thread to listen for data (your network communication library will probably do this anyway) and to communicate results back to your UI.
- likely you don't need the additional overhead and facilities of a Task in this case.
Tasks and Platform.runLater are not mutually exclusive. For example if you want to update your GUI based on a partial result from an in-process task, then you can create the task and in the Task's call method, use a Platform.runLater to update the GUI as the task is executing. That's kind of a more advanced use-case and is documented in the Task documentation as "A Task Which Returns Partial Results" http://docs.oracle.com/javafx/2/api/javafx/concurrent/Task.html -
How do you monitor a background thread and update the GUI
Hello,
I have a thread which makes its output available on PipedInputStreams. I should like to have other threads monitor the input streams and update a JTextArea embedded in a JScrollPane using the append() method.
According to the Swing tutorial, the JTextArea must be updated on the Event Dispatch Thread. When I use SwingUtilities.invokeLater () to run my monitor threads, the component is not redrawn until the thread exits, so you don't see the progression. If I add a paint () method, the output is choppy and the scrollbar doesn't appear until the thread exits.
Ironically, if I create and start new threads instead of using invokeLater(), I get the desired result.
What is the correct architecture to accomplish my goal without violating Swing rules?
Thanks,
Brad
Code follows:
import java.lang.*;
import java.io.*;
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
public class SystemCommand implements Runnable
private String[] command;
private PipedOutputStream pipeout;
private PipedOutputStream pipeerr;
public SystemCommand ( String[] cmd )
command = cmd;
pipeout = null;
pipeerr = null;
public void run ()
exec ();
public void exec ()
// --- Local class to redirect the process input stream to a piped output stream
class OutputMonitor implements Runnable
InputStream is;
PipedOutputStream pout;
public OutputMonitor ( InputStream i, PipedOutputStream p )
is = i;
pout = p;
public void run ()
try
int inputChar;
for ( ;; )
inputChar = is.read();
if ( inputChar == -1 ) { break; }
if ( pout == null )
System.out.write ( inputChar );
else
pout.write ( inputChar );
if ( pout != null )
pout.flush ();
pout.close ();
else
System.out.flush();
catch ( Exception e ) { e.printStackTrace (); }
try
Runtime r = Runtime.getRuntime ();
Process p = r.exec ( command );
OutputMonitor out = new OutputMonitor ( p.getInputStream (), pipeout );
OutputMonitor err = new OutputMonitor ( p.getErrorStream (), pipeerr );
Thread t1 = new Thread ( out );
Thread t2 = new Thread ( err );
t1.start ();
t2.start ();
//p.waitFor ();
catch ( Exception e ) { e.printStackTrace (); }
public PipedInputStream getInputStream () throws IOException
pipeout = new PipedOutputStream ();
return new PipedInputStream ( pipeout );
public PipedInputStream getErrorStream () throws IOException
pipeerr = new PipedOutputStream ();
return new PipedInputStream ( pipeerr );
public void execInThread ()
Thread t = new Thread ( this );
t.start ();
public static JPanel getContentPane ( JTextArea ta )
JPanel p = new JPanel ( new BorderLayout () );
JPanel bottom = new JPanel ( new FlowLayout () );
JButton button = new JButton ( "Exit" );
button.addActionListener ( new ActionListener ( )
public void actionPerformed ( ActionEvent e )
System.exit ( 0 );
bottom.add ( button );
p.add ( new JScrollPane ( ta ), BorderLayout.CENTER );
p.add ( bottom, BorderLayout.SOUTH );
p.setPreferredSize ( new Dimension ( 640,480 ) );
return p;
public static void main ( String[] argv )
// --- Local class to run on the event dispatch thread to update the Swing GUI
class GuiUpdate implements Runnable
private PipedInputStream pin;
private PipedInputStream perr;
private JTextArea outputArea;
GuiUpdate ( JTextArea textArea, PipedInputStream in )
pin = in;
outputArea = textArea;
public void run ()
try
// --- Reads whole file before displaying...takes too long
//outputArea.read ( new InputStreamReader ( pin ), null );
BufferedReader r = new BufferedReader ( new InputStreamReader ( pin ) );
String line;
for ( ;; )
line = r.readLine ();
if ( line == null ) { break; }
outputArea.append ( line + "\n" );
// outputArea.paint ( outputArea.getGraphics());
catch ( Exception e ) { e.printStackTrace (); }
// --- Create and realize the GUI
JFrame f = new JFrame ( "Output Capture" );
f.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE );
JTextArea textOutput = new JTextArea ();
f.getContentPane().add ( getContentPane ( textOutput ) );
f.pack();
f.show ();
// --- Start the command and capture the output in the scrollable text area
try
// --- Create the command and setup the pipes
SystemCommand s = new SystemCommand ( argv );
PipedInputStream stdout_pipe = s.getInputStream ();
PipedInputStream stderr_pipe = s.getErrorStream ();
// --- Launch
s.execInThread ( );
//s.exec ();
// --- Watch the results
SwingUtilities.invokeLater ( new GuiUpdate ( textOutput, stdout_pipe ) );
SwingUtilities.invokeLater ( new GuiUpdate ( textOutput, stderr_pipe ) );
//Thread t1 = new Thread ( new GuiUpdate ( textOutput, stdout_pipe ) );
//Thread t2 = new Thread ( new GuiUpdate ( textOutput, stderr_pipe ) );
//t1.start ();
//t2.start ();
catch ( Exception e ) { e.printStackTrace (); }
Thanks for pointing out the SwingWorker class. I didn't use it directly, but the documentation gave me some ideas that helped.
Instead of using invokeLater on the long-running pipe-reader object, I run it on a normal thread and let it consume the output from the background thread that is running the system command. Inside the reader thread I create a tiny Runnable object for each line that is read from the pipe, and queue that object with invokeLater (), then yield() the reader thread.
Seems like a lot of runnable objects, but it works ok. -
JTable Updates From a Separate Thread?
Using the code below, the "Thread Row" cell never shows up in the applet (the addRow method doesn't seem to work from a separate thread). Any suggestions would be appreciated.
Andrew
public class TestClass extends Applet {
DefaultTableModel m_tableModel;
public void init() {
m_tableModel = new DefaultTableModel(0, 3);
m_tableModel.addRow(new Object[]{"start"});
JTable jtable = new JTable(m_tableModel);
this.add(jtable);
Thread blah = new Thread(new temp());
blah.start();
private class temp implements Runnable {
public void run() {
m_statusTableModel.setValueAt("Thread Test", 0, 1);
m_statusTableModel.fireTableDataChanged();
m_statusTableModel.addRow(new Object[]{"Thread Row"});
m_statusTableModel.fireTableDataChanged();
}That was a typo. I renamed it and it still doesn't work. The "Thread Row" cell still does not show up. I am using IE5.5 with the following as my html page that references the applet. Can you please post the HTML you used to view your applet, as well as the browser you are using?
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<OBJECT classid="clsid:CAFEEFAC-0013-0001-0000-ABCDEFFEDCBA"
id="upapplet" name="upapplet" WIDTH = 510 HEIGHT = 414
codebase="http://java.sun.com/products/plugin/1.3.1/jinstall-131-win32.cab#Version=1,3,1,0">
<PARAM NAME = CODE VALUE = "JTableApplet.class" >
<PARAM NAME="type" VALUE="application/x-java-applet;jpi-version=1.3.1">
<COMMENT>
<EMBED
type="application/x-java-applet;jpi-version=1.3.1"
CODE = JTableApplet.class
WIDTH = 400
HEIGHT = 400
scriptable=false
pluginspage="http://java.sun.com/products/plugin/index.html#download">
<NOEMBED>
alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."
Your browser is completely ignoring the <APPLET> tag!
</NOEMBED>
</EMBED>
</COMMENT>
</OBJECT>
</BODY>
</HTML> -
How can i fetch only the updated contacts from SQLServer to local SQLite database?
Hi,
I need to update my local AIR Contact application (HTML/AJAX) with the new contacts from the SQL Server (interacting with J2EE).
How can i do it?
Do, i have to create a background thread which Pulls (requests) data periodically, and the server response is an XML file with sql scripts? If yes, How can i do this. Is there an sample application whose source i can look at?
Thanks.Hi,
I need to update my local AIR Contact application (HTML/AJAX) with the new contacts from the SQL Server (interacting with J2EE).
How can i do it?
Do, i have to create a background thread which Pulls (requests) data periodically, and the server response is an XML file with sql scripts? If yes, How can i do this. Is there an sample application whose source i can look at?
Thanks. -
Hi,
Camera launched from app using UIImagePickerViewController shows a black preview, if there is any operation running in the background thread. This was not an issue in ios 6. Can you please fix this with next update?
Thanks & Regards,
Dileep KumarSome things that might help:
1. Only the most recently used apps actually occupy memory (used to be the most recent 4, but may have changed in the latest iPhones). After 4 (or so), IOS writes them out of active memory, as it does for even the latest 4 if there's no activity for a long time. So the business of closing all the open apps, apart from the most recent ones doesn't make a difference. Tis article has a good explanation:
http://www.speirs.org/blog/2012/1/2/misconceptions-about-ios-multitasking.html
2. There are settings about background app activity that might help:
- Settings, General, Background App Refresh controls which apps can update their data in the background
- Settings, Notifications controls which apps can tell you things, which they have to wake up to do.
- Settings, Privacy, Location Services controls which apps monitor your location - another activity that uses resources
Hope some of that helps -
The background thread running lazy writer encountered an I/O error
Hi I have a test server which has thrown the following error
File system error: A system error occurred while attempting to read or write to a file store. The system might be under memory pressure or low on disk space. Physical file: \\?\F:\MSAS11.DEPLOYAS\OLAP\Data\Prod_KCube.0.db\DIM Flags And Types.0.dim\3.Flag
Types Key.khstore. Logical file: . GetLastError code: 8. File system error: The background thread running lazy writer encountered an I/O error. Physical file: \\?\F:\MSAS11.DEPLOYAS\OLAP\Data\Prod_KCube.0.db\DIM Flags And Types.0.dim\3.Flag Types Key.khstore.
Logical file: . Errors in the OLAP storage engine: An error occurred while processing the 'Facts' partition of the 'Main Facts' measure group for the 'Prod_Cube' cube from the Prod_KCube database.
The cube sits on a not very well maintained server which is used by various users (it is a test server) with the following specs
Intel(R) Xenon(R) CPU x5690 @3.47GHz
24GB Ram
64 Bit operating system.
The Cube data and logs are on separate drives and have plenty data but the C drive (where SQL Server is installed) only has3.5Gb of space left.
It's a fairly big cube and I've managed to get it running by processing dimensions and facts bit by bit but errors when processed all together.
What could be causing the errors above?Hi aivoryuk,
According to your description, you get the lazy writing error when processing partitions. Right?
In this scenario, the issue may cause by low memory for SSAS and lack of disk space. Please consider configure
Server Properties (Memory Page) and increase
memory setting for SSAS. If the .cub file is located in C drive, please reserve more disk space.
Please refer to a similar thread below:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/21bf84c5-f89a-464a-a5f1-2649fae5eb1e/while-processing-large-cubes-various-file-system-errors-the-background-thread-running-lazy-writer?forum=sqlanalysisservices
Best Regards,
Simon Hou
TechNet Community Support -
Calling a delegate on the UI thread from a work thread inside a child class.
Hi All,
I've run into a snag developing a WPF multithreaded app where I need to call a method on the UI thread from my work thread, where the work thread is running a different class.
Currently I am trying to use a delegate and an event in the 2nd class to call a method in the 1st class on the UI thread. This so far is not working as because the 2nd class is running in its own thread, it causes a runtime error when attempting to call
the event.
I've seen lots of solutions referring to using the dispatcher to solve this by invoking the code, however my work thread is running a different class than my UI thread, so it seems the dispatcher is not available?
Below is as simplified an example as I can make of what I am trying to achieve. Currently the below code results in a "The calling thread cannot access this object because a different thread owns it." exception at runtime.
The XAML side of this just produces a button connected to startThread2_Click() and a label which is then intended to be updated by the 2nd thread calling the updateLabelThreaded() function in the first thread when the button is clicked.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Threading;
namespace multithreadtest
public delegate void runInParent();
public partial class MainWindow : Window
public MainWindow()
InitializeComponent();
threadUpdateLabel.Content = "Thread 1";
private void startThread2_Click(object sender, RoutedEventArgs e)
thread2Class _Thread2 = new thread2Class();
_Thread2.runInParentEvent += new runInParent(updateLabelThreaded);
Thread thread = new Thread(new ThreadStart(_Thread2.threadedTestFunction));
thread.Start();
public void updateLabelThreaded()
threadUpdateLabel.Content = "Thread 2 called me!";
public class thread2Class
public event runInParent runInParentEvent;
public void threadedTestFunction()
if (runInParentEvent != null)
runInParentEvent();
I'm unfortunately not very experienced with c# so I may well be going the complete wrong way about what I'm trying to do. In the larger application I am writing, fundamentally I just need to be able to call a codeblock in the UI thread when I'm in a different
class on another thread (I am updating many different items on the UI thread when the work thread has performed certain steps, so ideally I want to keep as much UI code as possible out of the work thread. The work threads logic is also rather complicated as
I am working with both a webAPI and a MySQL server, so keeping it all in its own class would be ideal)
If a more thorough explanation of what I am trying to achieve would help please let me know.
Any help with either solving the above problem, or suggestions for alternative ways I could get the class in the UI thread to do something when prompted by the 2nd class in the 2nd thread would be appreciated.
Thanks :)If I follow the explanation, I think you can use MVVM Light messenger.
You can install it using NuGet.
Search on mvvm light libraries only.
You right click solution in solution explorer and choose manage nugget...
So long as you're not accessing ui stuff on these other threads.
using GalaSoft.MvvmLight.Messaging;
namespace wpf_Tester
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
public MainWindow()
InitializeComponent();
Messenger.Default.Register<String>(this, (action) => ReceiveString(action));
private void ReceiveString(string msg)
MessageBox.Show(msg);
Dispatcher.BeginInvoke((Action)delegate()
tb.Text = msg;
private void Button_Click(object sender, RoutedEventArgs e)
Task.Factory.StartNew(() => {
Messenger.Default.Send<String>("Hello World");
What the above does is start up a new thread - that startnew does that.
It sends of message of type string which the main window has subscribed to....it gets that and puts up a message box.
The message is sent from the window to the window in that but this will work across any classes in a solution.
Note that the receive acts on whichever thread the message is sent from.
I would usually be altering properties of a viewmodel with such code which have no thread affinity.
If you're then going to directly access properties of ui elements then you need to use Dispatcher.BeginInvoke to get back to the UI thread.
I do that with an anonymous action in that bit of code but you can call a method or whatever instead if your logic is more complicated or you need it to be re-usable.
http://social.technet.microsoft.com/wiki/contents/articles/26070.aspx
Hope that helps.
Technet articles: Uneventful MVVM;
All my Technet Articles -
When updating itunes from 10.0.1.22 to anything higher, my network card stops working, HELP!
I have an iPhone 3gs, and a work iPhone 4 on iOS 4.3.3. I want to sych with iTunes but clearly must upgrade to >10.1
When I do, my network card no longer works on my desktop. Please HELP!
My spec is;
NETWORK CARD;polydorus wrote:
This isn't my thing, but the following post on this seems to have helped some people:
http://discussions.apple.com/thread.jspa?messageID=12622179#12622179
That's the go-to advice with this one, p. (I certainly don't have much to offer beyond it, but it does a superb job in the vast majority of instances.) -
Background threading + batch file processing
Hello,
I have 2 issues in the same project.
Issue 1:
I have a project accessing the Object API. I've created a DLL assembly using VB.NET. This assembly is instatiated from a VB form and one of the functions is called using a background thread worker from the from. This code runs normally when NOT running in the background worker. However running in the background worker throws an exception. I have attached some sample code. To test it would will need to create the an interop for the Object API compenent for GroupWise. It ws too big to attach here. My apologizes for that.
Issue 2:
In the same project using the same assembly, I am calling the application from a batch file. Again the code runs normally from the debugger, but running the batch file throws an exception instantiating an instance of the Application object.
If anyone can shine some light on these issues that would be great.
Thanks
TimHiroto, no I didn't have it checked. I don't know why I was able to get as far as I did but enabling access for assistive devices didn't change anything. I am able to emulate /almost/ any keystroke, except the up arrow, which normally allows me to move up in the "file type" selector button. The script below is ... functional ... except that it forces me to save each file as a 58MB uncompressed .tiff, and it refuses to respond to the "close front window" or 'keystroke "W" using command down' scripts. Getting through 300+ files this way will eat up my memory and hard drive in a matter of minutes. I suppose I could '$sh kill ####' from terminal if I could find the window process, but this is getting really hoaky!
THIS SCRIPT OPENS AND SAVES FILES, BUT DISALLOWS ANY TYPE SELECTION OR CLEANUP
set sFiles to (choose file with multiple selections allowed without invisibles)
repeat with aFile in sFiles
tell application "Preview" to run
tell application "System Events" to tell process "Preview"
tell application "Preview"
activate
open aFile
delay 8
tell application "System Events"
keystroke "S" using {command down, shift down}
delay 2 -- opens save as sheet
repeat 7 times
keystroke tab -- tab down to file selector (works fine)
end repeat
click down -- select button (doesn't do anything)
delay 1
keystroke up -- open file button menu (doesn't work)
keystroke up -- select next menu item above (doesn't work)
keystroke return -- shortcut to "save" button
delay 10 -- wait for save
keystroke "W" using command down -- close current window (doesn't work)
end tell
end tell
end tell
end repeat -
Making a jtable auto updates itself from a mysql table
Pretty much what the title says. How can i auto update the jtable for every time my mysql table is updated in anyway? i am implementing this auto update function in my admin program which displays a list of users who are online etc. from the moment a user is offline/online or changes other details displayed in my jtable, i want it to auto update the jtable as soon as the actual mysql table has been updated with new data...
I was thinking of re doing the whole jtable i made and create a thread for that table that has a infinite while loop that keeps repainting the jtable with the new updated data from a mysql table query eg select * from table and store the data into a resultset which then gets transferred into a vector. Load the vector into the jtbale and their ya go�.
what you think of this approach? Is their a better way to do this?
at the moment, as soon as my application opens, the jtable views all the data from my sql table, however if it doesnt auto updates itself, cheersi am implementing this auto update
function in my admin program which displays a list of
users who are online etc. from the moment a user is
offline/online or changes other details displayed in
my jtable, i want it to auto update the jtable as
soon as the actual mysql table has been updated with
new data...Well you can make some changes to make implementation easy
Ex: Create a table to keep a log of the changes in the system the dmin program read the log and replicate the changes as specified in the log on the table model.
When reading the log the admin program keep track of the sequence no of the last read log entry and it reads ony the entries which has larger seq numbers than the last read seq no
I dont think that it is critical to make this to be cloase to real time. An Update once a 1 or 2 secs should be sufficient. -
Activate Update Rules from Business Content
Hello,
I am trying to install 0QM_C10 from business content. Every thing works fine except there are no update rules (there are 3 info sources for this cube). I am new to this and it doesn't make sense for me to manually create (ofcourse the system does the proposal) update rules. Since that is lot of work. I was expecting some transaction / tool where I can activate the update rules from the Business Content (since I can see the update rules in the business content under "Display Description". Is there any tool like that?
Or, am I doing some thing wrong so the update rules are not automatically installed from the business content along with Cube and info sources?
Note: I did separate installation for cubes as well as info sources from business content using Grouping by "Only necessary objects" option.
Thanks in advance.
Bala
Message was edited by: Bala Lingamaneni
Message was edited by: Bala LingamaneniBala,
please don't uncheck the checkbox that you find when you open a new thread (let it as default!)...this is the only way to be able to assign points to your helper !
Write a request (as a normal post) into SDN Suggestion forum in which you ask to Marc Bernard or Mark Finnern to convert this post as question !
Bye,
Roberto -
Exporting a jpeg in background thread: ID CS5
Hi All,
I am working on a plugin for CS5 and CS5.5, My plugin requirement is that it should export a document to pdf and jpeg format on background thread, On looking into CHM I found that there is a article "Asynchronous exports, Multithreading" which says that only IDML and pdf are the two formats that can be export in background thread.
Is is possible eto export a document in JPEG format on bakground thread? if yes then should I need to follow aproach mentioned in chm article "Asynchronous exports, Multithreading" or there is some other way to do it.
Please help me to find out a way using which I can achieve this.
Thanks
Alamtopfuelmaniac,
I believe the issue will be solved if both the artwork and the Artboard are aligned with the pixel grid.
The Transform Palette has the option Align to Pixel Grid.
The artwork may be off, and if so, it is better to align it properly than to snip off parts to fit the size it should have from the start.
If you have portions of the artwork, such as parts of strokes, outside the Bounding Box, you may have to rethink. You can turn on Use Preview Bounds in the preferences to see the real size to be exported. -
How do I remove the Adobe updater icon from the menu bar?
How can I remove the Adobe Updater icon from the menu bar? It's pixelated and looks broken. Any help is appreciated.
I found this thread, but it doesn't work. When I click on the Updater icon, then click "Open updater," it opens the Creative Cloud instead. I haven't found a way to remove the updater icon from within Creative cloud.
Remove Adobe Updater from OS X menu bar?
^^ Doesn't work
Anyone know how to remove it?
Thanks!Found it, thanks to later posts in that thread I mentioned in the OP. Here is what they suggest (you have to use Photoshop):
1. In Photoshop, go to Help >Updates:
2. Click "Preferences" at the bottom right.
3. Uncheck the box labeled "Notify me of new updates on the menu bar." Then click "Ok."
Hope that helps anyone! -
Updating UI from mainmethod of NSthread
I want to perform a heavy task in a worker thread, so I have started an NSThread. However, i want to periodically update the UI from the worker thread.
Currently I am directly accessing the UI objects like NSTextField * and updating the text from the NSThread's mainmethod.
But I think this is not the right way of doing this, because worker thread should not access UI elements. Any suggestions on how I can achieve this?The question comes down to: "What's the best way for the worker thread to communicate with the main thread?". Once you have a stable communication channel, the worker thread can post the info the main thread needs to update the UI. I've used global data structures with mutex locks in the past, but can't say that's the best approach. You'll want to find the balance between safety, simplicity and performance that's right for your app. And I think it's always a good idea to make sure you don't have a less risky alternative before starting a new thread.
Anyway if you really need another thread, take a look at Interthread Communication in the +Threading Programming Guide+.
Maybe you are looking for
-
Hello all, I've created a VI that reads from a CAN based sensor and shows the response on a waveform graph as Temperature and Concentration. Now I need to make this VI into a subVI, however, I'm having problems with the terminals and function of the
-
Jsf 1.2 to 2.0 migration
Hello, my applications are running on jsf 2.0 but my standalone weblogic v10.3.6 server on 1.2 version. I search around for solutions but with no luck on step by step for new users like me. I know how to deploy the library on the server but it doesn
-
How to disable air play on Iphone 5s
How to disable air play on Iphone 5s so I can use fire/HDMI adaptor to see on TV
-
Negative Leave Deduction Impact on Separation Process
Dear All, If an employee took a paid leave in addition to what he is eligible. Bcoz system is having negative deduction option of additional 10 days. But, the employee came from his vacation and submitted his resignation and relieving on the same da
-
Sign-in request every time iTunes launches
iTunes 12.1.0.26, OSX 10.10 - Every time I launch iTunes program I get a sign-in box and must input my iTunes password. iTunes should remember I've signed in. How do I solve this problem please?