tjs157 Posted November 5, 2009 Report Share Posted November 5, 2009 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. Quote Link to comment
asbo Posted November 5, 2009 Report Share Posted November 5, 2009 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. Quote Link to comment
Phillip Brooks Posted November 5, 2009 Report Share Posted November 5, 2009 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. Tri-state LED XControl Example - LAVA LabVIEW Idea Exchange: XControls-Inherit the properties/methods of a base control Quote Link to comment
Yair Posted November 5, 2009 Report Share Posted November 5, 2009 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. Quote Link to comment
Ton Plomp Posted November 5, 2009 Report Share Posted November 5, 2009 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.