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
Posts: 214
Registered: ‎03-18-2012
My Device: 8520
My Carrier: Company
Accepted Solution

In Qml document how to identify the components..

Hi,

 

I  have a Qml document in which i have one label and button . on button's  click i want to change the text of the label but i donot know how to identify the  label in the button's onClick methode.

Highlighted
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: In Qml document how to identify the components..

Just add the id property, say

Label {

  text: "My Label"

  id: lblMyLabel

}

 

Developer
Posts: 214
Registered: ‎03-18-2012
My Device: 8520
My Carrier: Company

Re: In Qml document how to identify the components..

Hi,
can you specify what is syntax for the onclick methode
onClicked: {

}
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: In Qml document how to identify the components..

as you wrote...

Developer
Posts: 214
Registered: ‎03-18-2012
My Device: 8520
My Carrier: Company

Re: In Qml document how to identify the components..

Hi,

right answer is
lblMyLabell.setText("AShish");
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: In Qml document how to identify the components..

this will also work:
lblMyLabel.text = "your text"

it will call the setter (setText) internally.
";" at the end is optional.

Andrey Fidrya, @zmeyc on twitter