Jump to content

Abort a called VI and continue


Recommended Posts

Hello

I need to choose one of several thumbnails to view a larger image. This seems to work fine. If the user clicks on the larger image I want to show another, sometimes very large image at maximum size. This seems to take a few seconds on the type of computer my users will have. This is the problem, the time it takes to read and display the large image.

What I'd like to do is start the process of reading the very large image as soon as the user has clicked on a thumbnail, and then abandon it if he clicks another, even before the reading has finished.

In general terms I'm looking for a method to abort a vi while keeping the calling vi running.

John

Link to comment

Start a background VI with VI server that waits on a notifier. When the user clicks on the thumbnail, send the notifier to the background VI (presumably a filepath) and have that vi load the data into a queue. when the background VI is done, it just waits for another notifier.

In that same background vi, monitor the notifer while loading a file. If a new notifer arrives, close the current file, flush the queue and then begin loading the new file into the queue. Use a null path to tell the background vi to stop and wait for the next filename.

I can see where your user might get click happy and cause alot of file I/O. This might be a problem if using FLASH based storage or a slow network connection. You might want to add a small delay (1 second?) before opening the file and beginning to read.

Your background VI might use a notifier to tell the calling VI that the data is available. It could even be the same data type as that sent to the background VI (file name) When the calling VI gets a notifier that matches the sent message, it could flush the queue and render the image.

Just some quick ideas. Is this for your app on your home page?

footerimage1.jpg

Link to comment

You may be able to use the Stop VI primitive, depending upon how you started the VI. If the VI you want to stop was invoked by a subVI call or using the Call By Reference node, then stopping the subVI is the same as stopping the caller VI, which would stop your whole program. But if the VI you want to stop was invoked by using the Run method of the VI Server reference, then that VI is a separate executing VI and you can just stop it.

The use of the notifiers/queues/etc mentioned by the other post is useful if you need to know in your original caller that the stop has occurred. But if you don't need such messaging, the Stop VI may be easiest.

Link to comment

Thank you all

I've taken some help from all three! Seems to work fine!

I start the read VI as a VI_Server 'Run' method, and stop it using a global signal and the Stop vi primitive. It seems to need the read vi to have its front panel open…no doubt work on this will solve this issue.

Yes, it is part of my home page project. I like the idea of using computers and particularly the Internet to help relieve peoples sickness. With this new go-fast you have helped me add maybe an expert will look at a larger image and make a better decision than if he didn't look because it took too long to open the maximized cview.

Now to get a few intermediate sized compressions too.

Merry Christmas to you all

John

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.