Jump to content

Inherit boolean control and add functionality


Recommended Posts

Hi all,

I'm a C++ programmer and have learned to use and enjoy (the bang head on wall too many times way) OOP design principles. I would like to utilize the same ideas with the LVOOP architecture. One of the things I would like to do is create a class that inherits all the properties of the boolean control and add extra functionality. For example in C++ I would create two methods in my new CBooleanAlarm class called <void SetAlarm(bool bAlarm)> and <bool GetAlarm()>. When the application calls SetAlarm with true it would set the boolean red and blink. If SetAlarm was called with false, it would set the boolean green and turn off blinking. When the application calls GetAlarm it would return the current state of the control. I would like to be able to add additional functionality like this to other controls as well so a general approach would be appreciated.

What is the best way to approach this in LVOOP?

Thanks for your help.

Link to comment

I might be off-base here, but that sounds like a job for an XControl. Just drop a boolean on the facade VI and you can manipulate the Blinking property as appropriate.

Blinking is one of those things that doesn't work well with an XControl. The XControl facade is not running continuously, so the behavior is 'sometimes on' and 'sometimes off'.

The other thing that catches my attention is 'inherits'. You can't just make an XControl from a Boolean. You have to redefine all the properties and methods of the base control in your XControl.

Link to comment

To inherit a control you would indeed want an XControl.

You should note, however, that XControls are designed to be controls with code behind them, not controls inheriting from the existing LV controls. As such, I believe you won't get the properties of the control you're using in the XControl (I don't remember if you don't get them at all or if you don't get them only if you add your own property, but it doesn't really matter). There should be a tool in the LAVA code repository which allows you to create properties for the control automatically so that it inherits from a specific control. I believe it was created by Ton, but I never used it, so I can't comment on it.

Link to comment

Hi all,

What is the best way to approach this in LVOOP?

Unfortuntly you cannot inherit from build in controls.

I might be off-base here, but that sounds like a job for an XControl. Just drop a boolean on the facade VI and you can manipulate the Blinking property as appropriate.

Not really off-base, XControls can be seen as an OOP framework.

Please vote on this idea to inherit from standard controls.

Ton

Ton

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.