I have a small code which does the following
theLW.WriteLine("-Creating dictionaries...") 'create dico1 'create dico2 theLW.WriteLine("--Done") theLW.WriteLine("-Processing file...") 'do something theLW.WriteLine("-File processed...")
I was hoping that the info in the LW is "printed" as the program progresses to let the user know what is happening but all the messages are printed almost in a block. The steps create 'dico1' and create 'dico2' may take a few seconds and yet I do not get the sequence
Message 1 printed
Nothing is happening while the dictionaries are created
Message 2 printed
Does anyone know if there is a way of controlling the LW?
Solved! Go to Solution.
Perhaps you can solve your problem with some simple threading.
You can try to start a new thread which will write "Creating Dictionaries" in the LW
(or MessageBox) and wait for him to stop before you proceed with further commands.
First you need to import
and you need a sub like this:
Now you can initiate and start a new thread with
Dim Thread1 As New System.Threading.Thread(AddressOf writeLWStart)
Thread1.Start() ' Starting new thread
Thread1.Join() ' Waiting until the thread is done
MsgBox("End") ' or creating you dicos ..
You can also terminate your thread manually with an additional sub, if neccessary.
Hope that helps!
Try NXOpen.UF.UFUi.UpdateListingWindow to flush the list window buffer.
Rather than calling this after every theLW.WriteLine, I wrote a wrapper function:
Sub logOutput(ByVal stringList As List(Of String)) theLw.Open() For Each line As String In stringList theLw.WriteLine(line) Next line theUfSession.Ui.UpdateListingWindow() End Sub