CraigGraham Posted March 4, 2004 Report Share Posted March 4, 2004 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? Quote Link to comment
Michael Aivaliotis Posted March 4, 2004 Report Share Posted March 4, 2004 You need to use dynamic events and the Dynamic Event terminal on the left of the event structure. All the events of the calling VI must be registered this way in the sub-vi event structure. Can you describe what you are doing right now that is giving you problems? Quote Link to comment
regisphilbin Posted March 4, 2004 Report Share Posted March 4, 2004 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... Quote Link to comment
regisphilbin Posted March 4, 2004 Report Share Posted March 4, 2004 Here's picture #2. This is the BD of the SubVI. You have to place the Event Refnum control on the front panel and wire from the Main VI into this Subvi. Quote Link to comment
CraigGraham Posted March 4, 2004 Author Report Share Posted March 4, 2004 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. Quote Link to comment
CraigGraham Posted March 4, 2004 Author Report Share Posted March 4, 2004 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.