LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Xcontrol problem with subpanels and dynamic events

I'm busy trying again to expand my LV knowledge and have run into some problems.  I'm using LV 8.2.1.

 

I apologise if this is a silly question but I have tried googling ont he subject and haven't found anything of real help.

 

I am trying to learn a bit about XControls.

 

I have implemented an XControl with a subpanel.  I dynamically load various controls into the subpanel and want to communicate with the Main XControl via User Events.  I have successfully been able to dynamically load into the subpanel so that I'm not blocking the event handler in the XControl but the XControl doesn't seem to respond to any user events being fired.

 

 

I know the events ARE being fired because as soon as any FrontPanel object from the XControl (The congtents of the Subpanel are dynamically loaded and so aren't statically linked like the other contents of the XControl) ALL of the events are handled.  This means I can basically queue up hundreds of User Events in the XControl but they'll only actually be executed when I trigger a statically-linked event.

 

I recall a mention that User Events and Static Events occupy two seperate queues internally.  It seems that the XControl Event triggering is broken for user events.

 

On a related note it seems that once I register for certain events for front panel objects (Mouse down, Mouse up and Mouse mopve for my subpanel) I am unable to de-activate these events from within the XControl.  Outside of an XControl this works fine but the Event registration doesn't seem to respond at all to changes made to the Events from within the XControl.

 

 

 

I'm not posting any code at the moment because it would involve a lot of stuff at the moment.....  I'd appreciate first hearing if this is a known problem or if it has been fixed since LV 8.2.1.

 

Shane.

 

Ps Apologies for the large images..... :smileysurprised:

Message Edited by Intaris on 05-07-2009 04:40 PM
Message Edited by Intaris on 05-07-2009 04:42 PM
Message Edited by Intaris on 05-07-2009 04:43 PM
Download All
Message 1 of 8
(5,983 Views)

I'll try to explain things a bit better:

 

I want to create an XControl which takes an array of Objects as an argument and displays a listbox with the names of the Objects.  On selecting one of these Objects, the corresponding Front panel is placed into a subpanel on the XControl.  Since I want to receive live updates (Data changes while the VI within the Subpanel is running) I have created a program which does the loading and unloading of these Objects in parallel to the actual XControl.

 

 Facade:

 

 

The Background process is launched during the Init phase of the XControl.  The Object which is currently in the subpanbel of the XControl triggers Events to signal a change in data.  These Events are triggered every time a value on the FP is changed.

 

INIT of the XControl:

 

 

So the Background process is just to enable a parallel execution of XControl and Object in the sub-panel.  It plays no other role in the inter-VI communication.

 

Background Launcher : Just enabling parallel Execution

 

 

My problem is that the VIs thus launched are triggering Events (Which are registered in the XControl) but the events (UNIT UPDATE int he Image above) stack up but do not cause the XControl to go "Live".  Once an Event occurs which DOES cause the XControl to go "Live" ALL stacked events are processed (See Images in first post).

 

 I have created a workaround in that I have registered the "MouseDown", "Mouse Move" and "Mouse Up" Events for the Subpanel within the XControl.  These Events (although they are called quite often) are used to simply "trigger" the XControl so that the actual Update Events can be processed.  This works fine.

 

When I tried to be a bit more refined and activate the "Mouse Move" Event only between "Mouse Down" and "Mouse Up" I realised that switching the dynamic events on and off within the XControl was not working.  The only solution is to have the "Mouse Move" Event firing all the time when the mouse is moved in the sub-panel.  I would rahter be able to have control over the dynamic events.

 

So my Questions are:

1) Is it normal that User Events are stored within the XControl but are not causing the XControl to go "Live" or am I doing something wrong with my Dynamic Event registration?

2) Is it normal that Dynamic Events cannot be changed within an XControl are, again, am I doing something wrong with my Dynamic Event Registration?

 

Does that make sense to anybody?  I'm not sure I'm explaining myself very well at all.....

 

Shane

Message Edited by Intaris on 05-08-2009 06:00 AM
Message Edited by Intaris on 05-08-2009 06:04 AM
Download All
Message 2 of 8
(5,952 Views)

Intaris wrote:

I'll try to explain things a bit better:

...

 

Does that make sense to anybody?  I'm not sure I'm explaining myself very well at all.....

 

Shane


 

Hi Shane,

 

Two of the other architects I work with are my XControl experts. I asked one of them to look at your post and he said that this sounds similar to an issue the other XControl expert had. He did mention updating to 8.6 may help.

 

The second XControl guy is out of the office but he worked arounf the issue by using a User event that could be fired via a method. If ton does not reply with a good answer I'll try to get the other XControl expert to see if he can offer any ideas (he owes me one for all of the "Can I ask you a simple question?" he has hit me with).

 

So you are being clear. It is just the complexities of teh XControl implementation that is confusing.

 

Take care,

 

Ben

 

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 8
(5,932 Views)

Thanks Ben,

 

Yet again you come to my rescue.   May be you should change your Avatar to a St. Bernard.....

 

I feel relieved that the problem was understood and that it sounds like others have had the same problem.  I thought I was missing something really obvious when I couldn't get it working.

 

I'm not quite clear on the workaround with the Method.  How does that work?  Just out of curiosity.  I can't really use this method because the Events I am triggering are used in different places.  I can't make my Objects XControl-aware because they lead separate lives.....

 

Thanks again and nice weekend to you all at DSAutomation.

 

If I ever get to NI Week, there'll be Beers for all you guys I promise.

 

Shane.

0 Kudos
Message 4 of 8
(5,929 Views)

Shane, did you ever come up with anything to get around this?  I have one Xcontrol inside of another, and i'm trying to catch dynamic events from the sub-Xcontrol, but the top level seems to ignore it.  I have confirmed that the event is being fired in a standalone test with just the sub-Xcontrol.

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 5 of 8
(5,268 Views)

XControls do not "wake up" to handle dynamic events for which they are registered. Try this method, instead:

 

Place a FP control of your message object (whether it be a LV Class control, a Cluster control, simply a string or Boolean control... whatever type the message is), hide the control or place it out of visible bounds, register for the "Val Change" in the XControl's Facade, and pass a control reference around to modules that you want to message. Rather than your current method of passing around a User Event ref for the Dynamic Event to catch (which it won't, you have found), you're going to fire a Val(Sgnl) on that control reference. This "dummy" message object on a Facade FP always allows the XControl Facade to "wake up" to handle the Val(Sgnl) event.

 

Errm... does that make sense?

Message 6 of 8
(5,244 Views)

 


Ben wrote:

 

Two of the other architects I work with are my XControl experts. I asked one of them to look at your post and he said that this sounds similar to an issue the other XControl expert had. He did mention updating to 8.6 may help.

 

The second XControl guy is out of the office but he worked arounf the issue by using a User event that could be fired via a method. If ton does not reply with a good answer I'll try to get the other XControl expert to see if he can offer any ideas (he owes me one for all of the "Can I ask you a simple question?" he has hit me with).

 


I'm going to disagree with the first point... upgrading won't help. From my experience with each version since 8.2, XControls by design do not immediately handle Dynamic Events to which they are registered. Why? I don't know, this is counterintuitive and unexpected, but I don't think upgrading is going to help.

 

Second, "sending messages" via a method is also acceptable. The question becomes, do you pass around a reference to the "dummy FP messaging object" (or have it wrapped), or do you pass around a ref to the XControl to each parallel module/process that wants to message the XControl? Your own experience will dictate which method seems cleaner.

 

Message 7 of 8
(5,238 Views)

Umm... let's see.  I'm not sure what exactly the first message meant.  When you're talking about placing objects and registering for Val Signal events, I don't know which Xcontrol you were talking about in which circumstance.  I think something that may add to the difficulty is the type of dynamic event I have, because it's based on a user menu selection.


Sub-Xcontrol has an intensity graph with a custom run time menu.  When the user makes a selection, it generates a user event that the top level xcontrol ideally would respond to.


What I think you were saying is put a dummy control on the sub-xcontrol front panel, and fire a value change event.  But, I don't think I can register for the value change of a specific item on the sub-xcontrol from the top level xcontrol, can I?


And if you meant put a dummy control ....

 

 

I get it now.  As I was typing that I realized what you meant.  When the user selects the right click menu item on the sub control, I take the dummy reference from it's state and wire soemthing the the value(signal) property.  The reference is linked to a dummy control on the top level xcontrol which has an event case for value change event of the dummy control. 

 

Many kudos.

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 8 of 8
(5,228 Views)