LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

corrupted TypeDef

I somehow got a corrupted TypeDef. I made a TypeDef of a system boolean control (although I suspect the control type I made a TypeDef of is irrelevant, but just this one got corrupted).

I placed a lot of these TypeDef-Controls on my FP. On the blockdiagram I created References for these controls. With "build-array" I created an array of these references. I connected the output from "build-array" to the Event-loop of my Producer/Consumer Design Pattern (Events) VI. I added the ValueChange-Events for all controls to one Event-Case (if there is an easier way than this, please let me know because I need a lot of controls, same goes for creating references for each control and building an array of these references, i use the order in which i added them to the build-array function). In this Event Case I connect the ctrlRef as the search element to "search 1D-array"-function and the reference-array to the array input of the "search 1D-array"-function. The "search 1D-array"-function never finds the ctrRef in the reference-array I build.

I found out that my TypeDef was corrupted by making a simplified VI from the Producer/Consumer Design Pattern (Events) and placing only two controls of the same kind in my VI but the rest exactly the same as described above. I also tested if a search 1D-array outside of the event-loop works, before the consumer and producer-loops start running. I found out that this always works, also in the case of my corrupted TypeDef. I started with two numeric digital controls and the search 1D-array worked inside and outside the event-loop. Also no problems with booleans, also no problems with system-booleans and i verified that mechanical action has also no influence on correctly comparing references. I made new TypeDefs to see if that caused any problems but also this did not reproduce my problem, even creating another TypeDef of the same system boolean control worked fine. Only when using my corrupted TypeDef the "search 1D-array" function always returns -1. I typecasted the ctrlRef I get inside the eventcase to U32 and this value differs from the one I read when I cast the corresponding reference of the control I evoked an event with, althoug control name and label.text are the same. Can I quickly select all my controls on the blockdiagram and replace them with a fresh TypeDef? All my controls on the frontpanel so that entails more work. Is there anyone who has an idea what could have corrupted my TypeDef or has anyone experienced something similar. Can I refresh or restore my corrupt Typedef perhaps? I tried replacing the control in my typedef but to no avail. Thanks in advance for your suggestions and answers and I apologize for my elaborate post. 

0 Kudos
Message 1 of 25
(2,918 Views)

Two references, while perhaps pointing to the same object do not have the be absolutely the same value.

 

 

0 Kudos
Message 2 of 25
(2,909 Views)

I read this: LabVIEW Artisan  but out of curiosity I typecasted the reference I received in the EventCase and the reference of the control directly to U32 (that is, the control that I would click on when running the VI to evoke the Event) and noticed that only in the case where the search 1D array function does not find the controlReference in the controlReferenceArray these two U32 numbers differ but even though, if the compare function does not compare the numeric values of the refnums but the objects they refer to I conclude that the two references refer to different objects and the reference I get in the EventCase is not refering to an object who's reference is in the controlReferenceArray. As I mentioned, I also checked Control Name and Label.Text, these both correspond to the control that dispatched the Event. How does the Equals function compare references exactly? I could only find that it compares if two references refer to the same objects, but how exactly, is there another property I can read to see what exactly goes wrong here? I need to replace the damaged Typedef I guess but I don't understand the reason why it got damaged in the first place.

0 Kudos
Message 3 of 25
(2,893 Views)

Well then can you post some code?

0 Kudos
Message 4 of 25
(2,876 Views)

I manually replaced all the controls with a new TypeDef, being of the same control type and that solved the problem but cost some time though. I just don't understand what went wrong with the TypeDef I had but it was definitely corrupted. I guess sometimes things can just get messed up. Thanks for reading my post and for your effort helping me find a solution. 

0 Kudos
Message 5 of 25
(2,868 Views)

Code would still be nice though because this might be a LV bug and we should try to save others from future inconvenience if that is true....

0 Kudos
Message 6 of 25
(2,863 Views)

I'll try to attach the code tomorrow but I had problems last time with attaching files because the browse button of the file select box hovered over the post button. maybe an update of my internet browser will solve that problem although I would think such basic functionality should be rather robust and work regardless.

0 Kudos
Message 7 of 25
(2,857 Views)

See attached a VI that demonstrates something is wrong with one of the two typedefs.

0 Kudos
Message 8 of 25
(2,807 Views)

Yeah, that's definitely weird behaviour.  I would try to draw the attention of a LV AE to the problem, it could well be a bug.

0 Kudos
Message 9 of 25
(2,802 Views)

Yes, I would like to do that.  How do I draw the attention of a LV AE to this problem? 

0 Kudos
Message 10 of 25
(2,795 Views)