I'm still not sure how custom control and object-oriented programming interact, can someone enlighten me please?

I spent some time trying to understand the relationship between the custom controls and object oriented programming. However, it is not quite clear to me yet.

What I want to do:

I want to have a custom control and hide its workings from the rest of the blockdiagram, so I don't have to wire for each similar object. Not only because I'm lazy , but also to keep the clean pattern and avoid mistakes.

for example, a graph, a numerical factor and a button.

When the button is pressed, the x scale must be changed according to the factor.

So, this looks like a job for me to object-oriented programming. Once I created something that can do this, I can use it all through my program. The code that redraws the figure when you press the button as part of the object, so I can't connect extra wires and add a value change event when I add a new chart.

Is this possible at all? I tried, but did not quite understand this time. I have to admit that I'm pretty new to OO programming and make custom controls. I use typedef clusters ' ed most my code so far, which works very well. But it's always a cluster of stupid, the only way to have nothing at all is in the block diagram in VI you use it in.

The only thing I could come up with so far is to add an "event handler" Subvi who does and that he accepts a reference or a local variable to an object. Then, this sub - VI and the variable or reference can be put in parallel with the other stuff in the main loop of the program. But there must be a better way somewhere?

I don't think I can solve this problem of definition of the objects of the Panel before custom and methods so that it can interact with the objects that it represents without help. I get the feeling that I must have missed it somewhere. The pointers will be appreciated.

Thank you!

Jacco.

Jacco K wrote:

What I want to do:

I want to have a custom control and hide its workings from the rest of the blockdiagram, so I don't have to wire for each similar object. Not only because I'm lazy , but also to keep the clean pattern and avoid mistakes.

...

The only thing I could come up with so far is to add an "event handler" Subvi who does and that he accepts a reference or a local variable to an object. Then, this sub - VI and the variable or reference can be put in parallel with the other stuff in the main loop of the program. But there must be a better way somewhere?

Thank you!

Jacco.

Hi Jacco,

These two things are exactly what are the Xcontrols, a basic VI with a façade that has an event structure (the façade VI).

If you have any questions, I'm happy to guide you.

Tone

Tags: NI Software

Similar Questions

Maybe you are looking for