Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
discnick
Posts: 17
Registered: ‎05-30-2012
My Device: Blackberry 10 Alpha Device
Accepted Solution

ComponentDefinition is not a type

Hello,

 

I am trying to implement the functionality provided by the ComponentDefinition class as shown on the following page,

 

https://developer.blackberry.com/cascades/reference/bb__cascades__qmlcomponentdefinition.html

 

Unfortunately an error occured when running the application and loading the qml file . The console output follows,

 

ComponentDefinition is not a type

 

Any advices anyone?

 

Please use plain text.
Developer
MFSI
Posts: 80
Registered: ‎09-03-2012
My Device: 9810

Re: ComponentDefinition is not a type

[ Edited ]

Yes I too got the same error.

 

I also tried changing ComponentDefinition with QmlComponentDefinition as analogous to ImagePaintDefinition when used with attachedObjects property to define an ImagePaint to draw a background image for the respective control.

This too results in the same error

 

Error 1    A colon after attachedObject property was missing

 

Error 2    Padding property is not available for Container object

 

Error 3    Actually no such classes named ComponentDefinition and QmlComponentDefinition were found in API References like we have class ImagePaintDefinition to define an ImagePaint in QML when used inside attachedObjects property.
       https://developer.blackberry.com/cascades/reference/classes.html

 

 

 

Always Success
Please use plain text.
Developer
Shubhangi
Posts: 97
Registered: ‎07-17-2008
My Device: Not Specified

Re: ComponentDefinition is not a type

Hi, Did you get solution for the above problem?

 

I am getting same error message.

 

Kindly help.

 

 

Thanks and regards,

Shubhangi

Please use plain text.
Regular Contributor
Megha_9_dec
Posts: 56
Registered: ‎08-21-2012
My Device: BB10

Re: ComponentDefinition is not a type

Hi discnick,

 

I tried making a sample for using Componentdefinition provided on the same link you've referred: https://developer.blackberry.com/cascades/reference/bb__cascades__qmlcomponentdefinition.html

 

Following is the code & I'm getting No such error like "Component Definition is not a Type" while running. The code is working successfully in my beta3 device. 

import bb.cascades 1.0

Page {
    Container {
        Button {
            text: "Click to create bordered text"
            onClicked: {
                // creates borderedTextComponent control and appends it to container
                var createdControl = borderedTextComponent.createObject();
                container.add(createdControl);
                createdControl.textString = "Hello Component";
                createdControl.padding = 30;
                createdControl.textColor = Color.DarkGray;
            }
        }
        Container {
            id: container
        }
        attachedObjects: [
            ComponentDefinition {
                id: borderedTextComponent
                Container {
                    property variant borderColor: Color.Red
                    property variant fillColor: Color.White
                    property variant textColor: Color.Black
                    property string textString
                    property real padding: 10
                    background:  borderColor//Color.Black //
                    leftPadding: padding
                    rightPadding: padding
                    topPadding: padding
                    bottomPadding: padding
                    Container {
                        background: fillColor// Color.Blue
                        Label {
                            text: textString
                            textStyle.color: textColor//Color.Green //textColor
                        }
                    }
                }
            }
        ]
    }
}

 No special inclusion for any file in app.cpp. Nothing.

 

Please use plain text.
Developer
Shubhangi
Posts: 97
Registered: ‎07-17-2008
My Device: Not Specified

Re: ComponentDefinition is not a type

Hi,

 

I tried sample given in the article but unable to run it.

Same error is occuring.

 

Kindly help.

 

Thanks and regards,

Shubhangi

Please use plain text.
Developer
discnick
Posts: 17
Registered: ‎05-30-2012
My Device: Blackberry 10 Alpha Device

Re: ComponentDefinition is not a type

Sry for the delay guys.

 

The problem does not exist any more.

 

I think the problem fixed once I updated my SDK to Beta 3 ( not 100% sure though..).

 

@ Shubhangi : can you confirm that you are using the Beta 3?

 

Please use plain text.
Developer
Shubhangi
Posts: 97
Registered: ‎07-17-2008
My Device: Not Specified

Re: ComponentDefinition is not a type

Hi Discnick,

 

 

How to check whether I am having beta2 or beta3?

 

Also How to upgrade to Beta3? Do I need to download Beta3 native SDK from Download and then install it directly on laptop?

 

Let me know.

 

Thanks and regards,

Shubhangi

Please use plain text.
Developer
discnick
Posts: 17
Registered: ‎05-30-2012
My Device: Blackberry 10 Alpha Device

Re: ComponentDefinition is not a type

Hi Shubhangi

 

From inside the QNX Momentics IDE , go to : Help  - About QNX Momentics IDE. On the About QNX Momentics IDE dialog check your version . The Beta 3 version number is : 10.0.9 .

 


In case you have not updated to Beta 3 , you should also look at this link also

https://developer.blackberry.com/cascades/documentation/dev/upgrading/index.html

Please use plain text.
Developer
Shubhangi
Posts: 97
Registered: ‎07-17-2008
My Device: Not Specified

Re: ComponentDefinition is not a type

Hi,

 

Thanks for reply.

 

I am having Beta2 version. I will upgrade the version to Beta3.

 

 

Thanks and regards,

Shubhangi

Please use plain text.
Developer
discnick
Posts: 17
Registered: ‎05-30-2012
My Device: Blackberry 10 Alpha Device

Re: ComponentDefinition is not a type

Hi Shubhangi,

Once you test your application on Beta 3, please post a feedback , in order to set this post as fixed.

Thanks in advance
Please use plain text.