DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

MsgBoxDisplay

I am using a Message box (MsgBoxDisp) to present to the user the filename and row # within that file so that progress can be monitored.

 

The msgBoxDisp command is inside a DoWhile loop. Loop count could range from 10 to 10000 depending on the data.

 

My problem is the screen redraw.  The window blinks to the point of being unreadable.  In fact, it appears to be bouncing back and forth between the dialog box (updated text each loop) and the main Diadem window.

 

Is there any way to stop this?  I tried just putting the text into the Statusbar, but it was blinking and unreadable there too!

 

Any ideas would be appreciated.  Here is the code

 

Do While ChannelIndex <= ChannelSize
 
  'Inform user of progress
  StatusMsg = "Now working with data file " & FileIndex & " of " & _
         FileCount & ":" & Chr(13) & NameSplit(CurrentFile,"N") & Chr(13) & _
         "Completed " & StopCount & " Cycles"
  Call MsgBoxDisp (StatusMsg, "MB_NoButton", "MsgTypeNote", _
         0, 0, 1,0)

.

.

.

.Loop

0 Kudos
Message 1 of 5
(4,366 Views)

Hello Jeff!

 

It is not possible to achive what you want - and IMHO users expect - with MsgBoxDisp.

 

There a two possible solutions:

  1. If you have DIAdem 11 you can use a non-modal SUD dialog (I have no experience with this)
  2. Design an external dialog and integrate it via GPI or COM. You can use the DIAdem main window handle in the variable MainHWND to get the right window order. That was my solution and it worked fine.

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 5
(4,364 Views)

I was afraid of that, Mathias.  Thanx for confirming.

 

Can you guess why the same blinking occurs when I try to update the Status bar instead?  Sounds like the smart thing to do is just put up the hourglass and hope the system doesn't lock up.

0 Kudos
Message 3 of 5
(4,349 Views)

Hi Jeff,

 

The simplest workaround would be to limit the maximum number of MsgBox updates to something like 20 or 50.  You would then determine in each loop if the current loop was one that gets to write to the MsgBox, such that you only updated the MsgBox every 5 loops or every 10 loops or so.  The user doesn't really need to see 1000 updates to the MsgBox and may have a hard time reading the numbers/text flying by even in the absence of flickering.  Depending on what you're doing in the loop, a DIAdem progress bar is another option.

 

'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 Product Support Engineer
National Instruments

0 Kudos
Message 4 of 5
(4,346 Views)

Thanks, Brad.

 

I tried the status bar...didn't work so well.  Its light gray and barely shows up...plus it changes in between steps, looks confusing.

 

The limiting to every 100 loop is a good compromise...good idea.

 

Jeff

0 Kudos
Message 5 of 5
(4,343 Views)