LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Class in LV

why does the derived class constructors if called in a application, referenced by the parents parent object gives Error 1448, even if to more specific class function is used among them at run time.

 

lvoop.png

 

Help me, discover more!! Smiley Wink

0 Kudos
Message 1 of 22
(3,622 Views)

I think you're going to have to attach some code to help us out. The picture you are showing has a broken run arrow so it won't throw error 1448 because it can't even run.

 

My guess is that you have instantiated a telecom class object and then tried to cast that to a mobile phone class.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 22
(3,582 Views)

@Jacobson-ni wrote:

The picture you are showing has a broken run arrow so it won't throw error 1448 because it can't even run...

 

...you have instantiated a telecom class object and then tried to cast that to a mobile phone class.


Sorry for the mistake.. 

 

bad_typecast.PNG

 

Let me explain the situation:

The Telecom is the root class as you can see in the hierarchy, am not giving the instantiate telecom's object here but, the each class object is connected at the other end of event structure: as device handling which predicts the input class object at that instant when user selects that control.

I'm think I need to find a procedure to publish Mobile class.Obj to be visible on the front panel of my application only through static read_Accessors. And note that, there are/should be no indicators inside my dynamic methods (MobilePh_has only dynamic dispatches).

 

I have attached the project for reference and please point out if there are any other corrections so that I could make my learning proper.

 

Note: This error persists only when device handled is not Mobile phone. 

0 Kudos
Message 3 of 22
(3,568 Views)

Why am I unable to connect all accessors directly in the application vi or through static methods too from the same class.. Smiley Sad

0 Kudos
Message 4 of 22
(3,554 Views)

@PriyadarsiniS wrote:

@Jacobson-ni wrote:

The picture you are showing has a broken run arrow so it won't throw error 1448 because it can't even run...

 

...you have instantiated a telecom class object and then tried to cast that to a mobile phone class.


Sorry for the mistake.. 

 

bad_typecast.PNG

 

Let me explain the situation:

The Telecom is the root class as you can see in the hierarchy, am not giving the instantiate telecom's object here but, the each class object is connected at the other end of event structure: as device handling which predicts the input class object at that instant when user selects that control.

I'm think I need to find a procedure to publish Mobile class.Obj to be visible on the front panel of my application only through static read_Accessors. And note that, there are/should be no indicators inside my dynamic methods (MobilePh_has only dynamic dispatches).

 

I have attached the project for reference and please point out if there are any other corrections so that I could make my learning proper.

 

Note: This error persists only when device handled is not Mobile phone. 


And that is the way it should work. You can't cast a class object to a sibling class, you can only cast a cast to the correct type of the object or to its parents.
So a Telefone object, running on the telecom wire, can't be cast to a mobile.

The error you get is correct. If you put a Telefon, Telegraf or  Walkie Talkie object on the wire you will get that error, as they are on a mobile class type, or any of the mobile class parent type. 

 

The important part is what class object is acutal running on the wire, not the wire class type. 

0 Kudos
Message 5 of 22
(3,521 Views)

You are correct!!

I was just reminding myself about abstract and encapsulated behaviors.

 

So, is there any easy way to play/accessible procedures to show an output on my Application, which is a data from child class. 

0 Kudos
Message 6 of 22
(3,513 Views)

PriyadarsiniS wrote:

So, is there any easy way to play/accessible procedures to show an output on my Application, which is a data from child class. 


I have used Subpanels to solve this issue.  You have a subpanel on your main VI's front panel and you just have the object load a "GUI" VI into the subpanel to show whatever data is needed.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 22
(3,504 Views)

@crossrulz wrote:


You have a subpanel on your main VI's front panel and you just have the object load a "GUI" VI into the subpanel to show whatever data is needed.


Sub-panel works but still only if I'm calling that VI (part of sub-panel code) in any of my application. If the data processed from derived class is checked whenever user is eager to check it, what can be done Tim.

 

Can this be done, in a way where a new sub-application (State-machine arch) is created for that derived class and calling this VI with any user interface actions that would disturb that particular class controls, alone..

And can we accomplish the same in Sub-panel class?!

0 Kudos
Message 8 of 22
(3,471 Views)

Your class GUI VI does not hav to be called directly from your main application.  It could be ran dynamically in a new thread and your objects send messages via queues or user events.  It could even be the processing VI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 22
(3,449 Views)

@crossrulz wrote:

Your class GUI VI does not hav to be called directly from your main application.  It could be ran dynamically in a new thread and your objects send messages via queues or user events.  It could even be the processing VI.


Can I get an example to understand this concept, Tim.

0 Kudos
Message 10 of 22
(3,440 Views)