08-15-2006 04:30 AM
08-17-2006 06:17 AM
04-22-2009 08:33 AM - edited 04-22-2009 08:38 AM
I have created an XControl with a Functional Global in it. I was storing a reference data type in the SR of the FG for use inside other instances of the XControl. This FG was only to be read internal to the XControl - not in code calling the XControl.
If the XControl is used in a main VI and also sub vis placed on the main VI block diagram the information from the XControl FG is available within all instances of the XControl.
If I call a subVI dynamically that is when I see the Facade have the correct value showing on the XControl (which means it is reading SOMETHING from the contained FG) - but the actual reference value out of the XControl is 0. The numerical value part of the data does get read out of the internal Functional Global but it seems like the actual reference value is lost.
Interestingly when I put a probe on the refnum wire out of the Open VI Reference.vi when calling my subVI - that magically makes the FG values read from the shift register valid in the instances of the XControl on the dynamically launched VIs.
Should a FG work internally to an XControl?
04-22-2009 09:20 AM
ok - I found that if I drop a Reinit to default Value on the block diagram of the dynamically called subVI that sets the XCtl to Default (thus firing some events not sure which?) in the Facade VI that the instantiated VI then gets the correct value out from the XControl....
This means to me that the FG value is being stored properly - but that I migth be reading it in the wrong spot in the case where VIs are dynamically loaded.
04-22-2009 09:36 AM
I tried taking the FG reads and putting them in the Timeout case in the Facade VI since this ALWAYS occurs when they XControl Facade VI is called into action.
This did not work.
HOW/WHY does an XControl load/react differently when a VI is dynamically loaded vs when you open it from within the project by double clicking on the VI?
04-22-2009 09:49 AM
Re the above Qs by Ryan.
Yes I work with Ryan and we are getting lost in the complexities of the XControl.
He has exausted my knowledge so I hope someone with a good undrstanding of the XControl and which events fire under which conditions can help us out.
I can only offer my humble thanks for helping us out (and a bunch of Kudos if you want them).
Thank you!
Ben
04-22-2009 10:01 AM
I have found that the Facade VI is firing the Data Change event (at least) when the Dynamic VI is opened.
The FG internal to the XCtl is passing out the value on the block diagram of the Facade correctly - the Data Changed? flag is being set to true.
However the value output by the XControl is not correct on the calling VI.
04-22-2009 10:24 AM
Another data point:
When I make the VI that is called on the Main VI block diagram reentrant and put a couple copies on the calling VI block diagram - the reentrant VI copies of the XCTl work properly
04-22-2009 10:27 AM - edited 04-22-2009 10:27 AM
04-22-2009 10:36 AM
RVallieu wrote:Another data point:
When I make the VI that is called on the Main VI block diagram reentrant and put a couple copies on the calling VI block diagram - the reentrant VI copies of the XCTl work properly
Sorry - I was wrong - reentrant VI did not work. When I stopped the main VI and then restart that is when the reentrant VIs Xctl works properly.