From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-20-2017 09:00 AM
Hello, im using progress bar functions in Diadem and in some cases it works, but i got a script to filter all channels in group, so i got following code:
Call LoopInit()
code in cycle:
Call ChnCFCFiltCalc(.... Call LoopInc(iProgressBar/iProgressBarCount*100) Call Pause(0.01)
code after cycle
Call LoopDeInit()
The progress bar display itself 1 one, and after its dissapears for the rest of the cycle. I think the function to filtrer channel is killing the progress bar, do u got the same behaviour?
// i know i can use ActiveX COM object to display different progress bar, i would like to use the internal one if its working
Solved! Go to Solution.
01-21-2017 08:53 AM - edited 01-21-2017 08:53 AM
Hello,
try to feed progress bar with integer values. Following code worked perfectly fine for me...
Dim iProgressBar, iProgressBarCount iProgressBarCount=222 Call LoopInit() 'Opens session to Progress bar For iProgressBar = 1 to iProgressBarCount 'Insert your code here Call LoopInc(trunc(iProgressBar/iProgressBarCount*100)) 'Updates the Progress bar with value between 0 and 100 Call Pause(0.01) Next Call LoopDeInit 'Clear the Progress bar
Reagards,
Ondřej K.
01-23-2017 05:00 PM
Hi Lukas,
Commands that generate new channels in the Data Portal usually highjack the Progress Bar. In those cases I usually use a non-modal dialog with MsgBoxDisp(), like this:
Sub MsgUpdate(Msg) 'updates the message shown in the non-modal dialog every time the ID stopwatch reaches DispSecs Dim ID, DispSecs ID = 9 DispSecs = 1.0 IF Stopwatch(ID) > DispSecs THEN Call MsgBoxDisp(Msg, "MB_NOBUTTON", "MsgTypeNote", 0, 0, 1) Call StopWatchReset(ID) END IF End Sub ' MsgUpdate()
If you still want to use the progress bar, don't introduce your own static pause, but rather poll to see if enough progress has happened to warrant a redraw, like this:
MsgBox "Click OK and watch the progress bar increment" '... much more quickly" 'This block of code is vastly more efficient 'The progress bar is only updated 100 times Loops = 150 CountStep = 5 ' % NextCount = CountStep Call LoopInit()'Opens session to Progress bar For i = 1 To Loops ' Start of your code (simulated here) StartTime = Timer Do EndTime = Timer Loop Until EndTime-StartTime > 0.05 ' End of your code (simulated here) LoopCount = Fix(100*i/Loops) IF LoopCount >= NextCount THEN Call LoopInc(LoopCount) ' Updates the Progress bar with value between 0 and 100 NextCount = NextCount + CountStep End If Next Call LoopDeInit 'Clear the Progress Bar
Brad Turpin
DIAdem Progress Support Engineer
National Instruments
02-06-2017 03:35 AM
Hi,
thanks for reply, your code works fine and i got a slow progress bar, but if i change the code to put a filtering function, the progress bar dont show at all
MsgBox "Click OK and watch the progress bar increment" '... much more quickly" 'This block of code is vastly more efficient 'The progress bar is only updated 100 times Loops = 150 CountStep = 5 ' % NextCount = CountStep Call LoopInit()'Opens session to Progress bar For i = 1 To Loops ' Start of your code (simulated here) Call ChnCFCFiltCalc("", Data.Root.ActiveChannelGroup.Channels(i), Data.Root.ActiveChannelGroup.Channels(i), "CFC_180", 0, "EndPoints", 10) ' End of your code (simulated here) LoopCount = Fix(100*i/Loops) IF LoopCount >= NextCount THEN Call LoopInc(LoopCount) ' Updates the Progress bar with value between 0 and 100 NextCount = NextCount + CountStep End If Next Call LoopDeInit 'Clear the Progress Bar
02-06-2017 04:29 PM
Hi Lukas,
Most of the DIAdem ANLAYSIS functions invoke the DIAdem progress bar, so it's confusing to try to direct that same progress bar with VBScript calls when other VBScript calls (that run an ANALYSIS routine) also try to control that one progress bar. My recommendation would be to use a non-modal dialog to display the sequencing of the different ANALYSIS function calls (across multiple channels, groups, or files), and let each ANALYSIS function automatically display its progress using the one DIAdem progress bar.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-06-2017 04:32 PM
Hi Lukas,
This is my preferred method to use the non-modal nature of the MsgBoxDisp() command. You could also create your own SUDialog and call it non-modally, but this is usually sufficient:
Sub MsgUpdate(Msg) 'updates the message shown in the non-modal dialog every time the ID stopwatch reaches DispSecs Dim ID, DispSecs ID = 9 DispSecs = 1.0 IF Stopwatch(ID) > DispSecs THEN Call MsgBoxDisp(Msg, "MB_NOBUTTON", "MsgTypeNote", 0, 0, 1) Call StopWatchReset(ID) END IF End Sub ' MsgUpdate()
Brad Turpin
DIadem Product Support Engineer
National Instruments