Jump to content

Yair

Members
  • Posts

    2,869
  • Joined

  • Last visited

  • Days Won

    44

Posts posted by Yair

  1. You already have numerous options, but I think the simplest one in terms of similar functionality is replacing the color box with a picture control and coloring its BG transparent. Then, you just need to draw a rect of the appropriate size and for the transparency you can either use the T color for the rect or use an empty picture. The main potential disadvantage with this is that picture controls can be problematic in terms of memory usage, but I think you should be fine in this case.

  2. This causes a race condition, because the first Event structure to handle the event can prevent the other Event structure from receiving the event if it completes the event case before the other Event structure executes.

     

    That description makes the behavior sound a lot milder than it actually is. If you do this, you might find events disappearing completely or being handled by more than one ES at the same time. You might find event structures freezing for no apparent reason, etc. In short, like I said, a big no-no.

  3. I do see something which is very wrong - you use the same event registration refnum for both event structures. That is a BIG no-no. If I change that and wire the cluster of event refnums into a separate register node, then there is no crash.

     

    Now, I'm not saying that a crash is the right behavior here (because it isn't), but you should definitely change your code. If you use an event registration reference for more than one structure, you will get various irreproducible bugs, because the system wasn't designed to work that way.

     

    There's a caveats section for events in the LV help which talks about this a bit, but the rule is simple - an event registration refnum should belong to only one event structure. The easiest way to enforce this is to always place the register node right next to the event structure itself, but you can also do the registration in a subVI and then bundle the reg refnums into the dynamic terminal. If you do that, make sure the VI outputs a different refnum for each call.

    • Like 2
  4. I did do this to make life a little easier.  I create the polymorphic instances programatically, but not the polymorphic VI itself.

     

    I'm pretty sure that in recent versions the programmatic interface to poly VIs has improved considerably. The PolyVI class has an InstanceInfo property which I believe allows you to control the members of the poly VI.

  5. So why did OpenG go through the trouble of making a version that works with 40+ other data types?

     

    The main reasons are probably cleanliness, code safety and efficiency. A variant will cause a data copy, which is not a big deal if you're comparing a boolean, but could be an issue if it's an array with 10M elements. If you also make all your VIs work only with variants, then you will either start getting variants in the BD or the user will be forced to repeatedly convert back (and possibly make mistakes).

     

    In the end, if you create a tool which will be reused many times, it takes considerably less effort to make it easy to use upfront than it does to make it simple to build. If you create an automated tool to help with the polyVI creation, then the effort becomes even more minimal.

     

    The real thing we need here is for LV to be able to automatically adapt VIs to work based on input type. NI has known this for years, but so far hasn't managed to come up with a stable and reliable mechanism. Hopefully at some point they will and then we won't have to deal with this any more.

    • Like 1
  6. You'll be happy to hear that people have thought of similar things before (for instance - http://forums.ni.com/t5/LabVIEW/LV2OO-Style-Global-VIs-from-NI-Week-2007-presentation/td-p/562527) and that LV has a much simpler mechanism for doing this - create a regular class, then create a data value reference to an object of that class. The DVR allows you to access the object using the reference. If you create property folders for the class, then the property node can even accept a DVR and get the object out of it automatically.

     

    A simple example:

     

    post-1431-0-93341500-1363623822.png

    • Like 2
  7. I can say that I've seen the driver error several times since then (including this week), but in all those times it was for the entire site. Trying to go to anywhere on the site produced that error. I don't know which error specifically you referred to still having and whether you still have it now, but obviously you managed to post to this thread successfully.

  8. I would suggest that you open the BD of every VI whose state is Run Top Level and then manually inspect their BDs for subVIs with the green arrow. This would at least minimize the amount of VIs you have to check (unless you open many dynamic VIs).

     

    The other alternative is that if you have actual stuff going on that you do use tracing but you only enable it when you get stuck. Presumably, at this point in time it won't matter even if it does alter run-time behavior. Of course, this won't help if there's nothing actually happening for you to trace.

  9. As far as I know, the answer is no.

     

    Things you can do -

    1. Add special code to the VI so that it logs when it starts running.
    2. Use the Desktop Execution Trace Toolkit, which should give you the VIs which are actually running. I think that it might also be possible to tap into that data yourself somehow, but that's not public knowledge. Maybe if you know the right people at NI you could get that info.

  10. There is another option I can think of, but I don't know if its performance will be any better - Get the VI's connector pane reference and use that to get the reference to the controls and the pattern. Then, use those reference and call the Application class method Data Type Color to get the color for each terminal and then draw the connector yourself based on the pattern. I'm assuming that the color is the one which actually appears in the con pane. You might be able to use code people already uploaded to make editing the con pane easier (I believe Mark Balla has one in the CR).

    • Like 1
×
×
  • Create New...

Important Information

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