LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting the named bundlers in an event structure: a conundrum

Solved!
Go to solution

Event frames have a named unbundler on the left-hand wall for nearly every event, and some events (those whose names end in "?") have a named bundler on the right-hand side of the event frame.

Capture.PNG

Using VI scripting (see image below), you can get a list of available elements for these bundlers, but you will find that both the source and sink bundlers will return the same list, which contains all elements available for the two bundlers combined. But the problem is that some are only available for the unbundler, some for the bundler, and some for both.

 

Capture2.PNG

The question is, how can we tell which elements are available for which un/bundler? I want the list of items that is shown in the contextual menu when you click on an unbundle item. My only solution so far was to programatically set all values to one of the existing elements and check for errors. However, turns out you can programatically set a right-side-only option to the left-side unbundler node: 

 

Capture3.PNG

 

As a side note, some of the elements that can bundled are mysterious to me. For the above example, it makes sense that you can "Discard?" the mouse click, which means to not do whatever that mouse click was intended to do in the usual case. But what does it mean to wire Button, Mods, or PlatMods?

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 1 of 7
(3,636 Views)

The event structure itself has a method Get Event Data Node and Get Event Filter Node that takes a frame. Both have a property Available Elements[].

0 Kudos
Message 2 of 7
(3,607 Views)

I have followed your suggestion. I took my reference to the bundler inside the event structure, getting the event reference from the ownership hierarchy, then the data and filter node elements for the visible frame using the methods you mentioned. Unfortunately, this returns the same available elements for both, which is to say not the list of actual available elements shown in the un/bundler nodes' rt-click menus. Since I already had those values, this didn't solve my problem.

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 3 of 7
(3,575 Views)
Solution
Accepted by topic author littlesphaeroid

Sorry about that.

 

This works though.

 

The FullElementNames[] property on the NamedUnbundler does not return a name for Discard?. So there is a way to distinguish the values:

 

Get EventStructure Inputs and Outputs.png

 

+ Wrapping this in an undo construction makes sense.

+ Calling GetEventFilerNode\GetEventDataNode without wiring the result crashes LabVIEW.

+ Don't even try to put GetEventFilerNode\GetEventDataNode in an array. The code looks duplicate, but isn't.

+ Some events (like Key Down?) have empty names available. Not sure how this is used. I'd filter them out for now...

+ On the up side, reading an output value, like Discard?, actually returns the last value written to Discard?. So there is room for exploration...

Message 4 of 7
(3,560 Views)

@littlesphaeroid wrote:

As a side note, some of the elements that can bundled are mysterious to me. For the above example, it makes sense that you can "Discard?" the mouse click, which means to not do whatever that mouse click was intended to do in the usual case. But what does it mean to wire Button, Mods, or PlatMods?


If these options are available, the will change the appearance of the key down to key down processing events further down the chain.

 

So, if you don't want someone to press shift+q, you can turn of shift when shift+q is pressed, and it will be further processed as just an q.

 

A better example is Mouse Down?. If someone left clicks a control, you can make it look like a right click (triggering a right click menu). Still not too useful, but convenient from time to time.

Message 5 of 7
(3,557 Views)

I'm curious about your right-click example. I've tried to code something up, to convert a left lick to a right click. I can see the utility in this, but not sure how to make it work.

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 6 of 7
(3,536 Views)

@littlesphaeroid wrote:

I'm curious about your right-click example. I've tried to code something up, to convert a left lick to a right click. I can see the utility in this, but not sure how to make it work.


It's mostly useful for UX (user experience) things. If the user wants a rings, that's easy. The ring acts like a menu. But now the menu needs to have levels, like a real menu. So, changing the left click to a right click will make a normal click show the menu. Almost like a 'menu control'.

 

The filter can also be useful to disable functionality. For strings, you can 'disable' typing certain characters. It's a bit harder that just filtering though, because there's also copy-paste. But filtering out characters can enhance the UX. Direct feedback can be important.

String Hex Filter.png

Message 7 of 7
(3,524 Views)