From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Register Event Callback problem with Linkam ActiveX controls

Solved!
Go to solution

nathand wrote:

Can you fix it by right-clicking the VI reference, Browse for Path..., and reselecting the callback VI?  Also make sure the callback VI reference is strictly typed.


Good tip; but no, re-browsing for the same callback VI doesn't work. And yeah, it's always strictly-typed.

0 Kudos
Message 11 of 16
(1,247 Views)

Hi Jack,

 

- How are you creating your User Event refnum control?

 

If you look closely the "String" datatype of the control, there is a 'space' character in its label in one, but not in the other.  If you right-click the User Event refnum wire, select Create » Control - copy that over to your broken VI and replace it as the User Parameter control - then the types match, and wires are no longer broken.

 

Basically it looks to me that the interface types are different as there is a difference in the datatype of the User Event refnum.


Regards,

Peter D

0 Kudos
Message 12 of 16
(1,234 Views)

Pete.Dunc wrote: 

If you look closely the "String" datatype of the control, there is a 'space' character in its label in one, but not in the other....


This is a red herring and not the issue, but it helped me solve the problem!!

 

I have my environment configured with "Tools >> Options >> Front Panel >> Connector pane terminals default to Required" set to True (that's LabVIEW.ini key reqdTermsByDefault=True) (this is a good safety net to ensure you're creating good APIs, but that's off topic)

 

When Callback VIs are created, they have all their terminals set to "Recommended" rather than "Required", so if I delete a terminal but add it right back, because of my IDE configuration, I now have a different conpane. Changing the newly created control from "Required" back to "Recommended" fixes the VI Interface Type mismatch!

 

This little piece of code with ConPane:DataType is what pointed me to the solution:

 

ConPaneGet.png

 

Which yields these results:

 

ConPaneOutput.png

 

And toss that into a diff:

 

ConPaneTextCompare.png

 

And wham, bam, thank you ma'am, problem solved.

 

I totally was feeling like Mugatu there for a while: "I feel like I'm taking Crazy Pills"

Message 13 of 16
(1,225 Views)

JackDunaway wrote:

 

When Callback VIs are created, they have all their terminals set to "Recommended" rather than "Required"


This opens up a discussion as to whether this behavior is desirable, or even a bug.

0 Kudos
Message 14 of 16
(1,224 Views)

Good catch - seems obvious when you see the answer Smiley Happy


Regards,

Peter D

0 Kudos
Message 15 of 16
(1,210 Views)

Years later but thank you thank you! I do a lot of my own callback implementations and my VM likes to not save state properly sometimes. Which makes LabVIEW reset all its preferences. Which means sometimes I'm creating terminals as required and sometimes not. I wish context help made this clearer but your ConPane.DataType PN trick was super useful.

 

Sometimes LabVIEW feels like Prolog... less like programming and more like tricking the compiler into doing what I want it to.

0 Kudos
Message 16 of 16
(764 Views)