Jump to content

Event Structures In Sub Vis


Recommended Posts

Since info-labview appears to be down again, I may as well try here. :)

I've done a bit of code that lets the user drag a frameless VI about the

screen by clicking+dragging on the inert parts of the panel. It's a fairly

big and self contained while loop that would be better off in a sub-VI, but

I can't figure out how to register the event structure in the sub-VI for

events from the calling VI. I've tried a few things that look sensible but

the events never get fired.

Has anyone managed this?

Link to comment

I've attached 2 pictures of how you can interact with a Sub VI from a top level VI using Dynamic Events. This first picture is of the Main VI. The 5 elements attached to the "register for events" node can be utilized on the Main VI and the respective actions dynamically sent to the Sub VI.

[edited:] Only have have 1 picture attached. How can I attach 2 pictures to this post? I can only select one...

post-19-1078423940.jpg?width=400

Link to comment

What I'm doing is pretty much as described and I can't see what's going wrong.

I've attached a block diagram of the simplest case. I call this diagram from a parent VI, whose only function is to get a VI ref and call this VI with it. The numeric I've shoved in there, and the coordinate indicator, show that the sub VI gets precisely one mouse move event when I move the mouse over the calling VI's window. After that, the event structure never fires. If a timeout is specified, the event structure simply keeps timing out and executing the timeout frame, which confirms that the while loop or the VI itself are not bailing out for some reason.

post-19-1078434613.jpg?width=400

Link to comment

Ah. The problem was that to test this, I first put the window move loop in the top level VI to get things working. I then copied it to a sub-VI and wrapped the original in a case structure, so I could switch between the sub-VI and the code in the top level.

It turns out that having the event structure on the top level, even though the frame wasn't executed, screwed up the sub VI. Pretty straightforward- I forgot all about it because it wasn't visible.

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
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.