LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Register Event Callback

Ok, now it works with the indicator elements inside the cluster, but the problem is that it doesn't give me the coords in all the cliks I do, it only does it sometimes.... like if it had an arbitrary retard.
0 Kudos
Message 11 of 24
(1,989 Views)

The callback VI has a control reference on the front panel, and its datatype is set to something. You can find out what kind it is by looking at the icon, so right-clicking on the control reference and select "Select VI Server Class" and seeing what's checked in the various submenus. The control reference that the callback VI is expecting has to match the type of reference that you wire to the "User Parameter" field. If you want to replace a string refnum in your callback VI with a cluster refnum there are several ways to do this. Here's one way:

  1. Open your callback VI. Move it to the side.
  2. Open your main VI's block diagram.
  3. Drag the cluster reference from your main VI's block diagram onto the callback VI's front panel. This will place a cluster refnum control on the callback VI's front panel.
  4. Replace the string refnum control with the cluster refnum control that was just created.
  5. Update your callback VI to write to the cluster using the Value property node. 
Message 12 of 24
(1,989 Views)

Carlos,

 

As you can see in the attached image, I wired a reference to a string into the user parameters. You can also see that this changed the  callback VI to have "String" instead of "User Parameter."

 

Inside the callback VI, I used this reference to wire a property node and change the value in the main VI. This is also a good way to test and make sure that your actual event is occuring, just by doing a simple test such as mine.

 

 

Message Edited by Chris_VH on 03-26-2009 10:46 AM
Chris Van Horn
Applications Engineer
Message 13 of 24
(1,987 Views)

Thanks Chris for your help but I have the activeX working finw now. I have a cluster reference and 3 indicators inside that take me the values of the ActiveX. The only "problem" I have it's that waht I said before. It's like if some times the ActeveX wouldn't work and sometimes yes. I discovered that if I put a retard of 100ms inside the main application, the ActiveX works better but only clicking and waiting a second (more or less) untill next click.

 

Thanks.

0 Kudos
Message 14 of 24
(1,972 Views)
Do you have any means of testing this ActiveX control in another environement (like VB) to see if the same behavior occurs?
0 Kudos
Message 15 of 24
(1,967 Views)
Yes, I have a demo about this ActiveX made with VB and works perfect.
0 Kudos
Message 16 of 24
(1,955 Views)
Not sure about the 100 msec wait, but the fact that you have to wait a second to register the next click sounds like your code may be holding it up. You've only posted a small part of your code, so it's hard to say.
0 Kudos
Message 17 of 24
(1,946 Views)

Now, don't worry about the delay, it's working fine for now, will see when I connect it to my whole application. The main problem is solved. Now I have another headache 😛 I want to modify a "Node Property" of the ActiveX with an event done in that ActiveX. That would be easy to implement but I'm in trouble when I have the cluster with both coordenates inside the second VI reference and can't unbundle it. It says it's a refnum cluster and there's no way to unbundle it.

Another question I have is that if I want to put somewhere (in a node property and an indicator) a value when a case structure is true and do nothing when it's false, what should I do? Because I can't run the app until I wire the tunnels of the false case, and I don't know where to wire them, so can't be configured to "default value" because that values are variables and I don't want to modify them in a false case, they modify  according to the ActiveX.

 

 

 

Here I attach the code of the ActiveX I have and the second VIref to do that double clicking event.

 

 

Download All
0 Kudos
Message 18 of 24
(1,914 Views)

CarlosSp wrote:

Now, don't worry about the delay, it's working fine for now, will see when I connect it to my whole application. The main problem is solved. Now I have another headache 😛 I want to modify a "Node Property" of the ActiveX with an event done in that ActiveX. That would be easy to implement but I'm in trouble when I have the cluster with both coordenates inside the second VI reference and can't unbundle it. It says it's a refnum cluster and there's no way to unbundle it.


I'm not sure why you're bundling the reference to your ActiveX control for that second event's "User Parameter" input. The reference to your ActiveX compoenent is already available on your callback VI and is automatically created when you create the callback VI. It's the "Control Ref" front panel control. That is the reference to your ActiveX control.

 


Another question I have is that if I want to put somewhere (in a node property and an indicator) a value when a case structure is true and do nothing when it's false, what should I do? Because I can't run the app until I wire the tunnels of the false case, and I don't know where to wire them, so can't be configured to "default value" because that values are variables and I don't want to modify them in a false case, they modify  according to the ActiveX.


 

 I have to admit I don't understand what you're asking here. Can you provide an example and/or screenshot of what you're trying to wire up?

0 Kudos
Message 19 of 24
(1,910 Views)

I didn't know that about "Control Ref" Then I don't need to wire the ActiveX component, but I have the same problem, can't unbundle the cluster refnum I get inside the VI ref.

 

 

Sorry if I did't explained the other problem wright. The fact is that I want to put an "Go to" button and 2 controls to put the X and Y coordinates where the user would want to go, but only when it's clicked the "Go to" button. If not,ActiveX must run normally, where you can move the map and view the points you want to. So, there's a node property that is "ViewCenterX" and "ViewCenterY", where I would want to put the value of the user's specified coordinates in case "Go to" button would be pressed. If not, that node properties, don't have to receive any data because they receive it automatically from the ActiveX.

0 Kudos
Message 20 of 24
(1,903 Views)