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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Regular Contributor
Posts: 63
Registered: ‎08-05-2013
My Device: Blackberry-10 webworks
My Carrier: zcon
Accepted Solution

Dynamic changes on qml page not working through cpp

[ Edited ]

Hi,

I want to change some UI of qml page dynamically according to web service response from cpp file. If  I make some changes I need to reload the qml page everytime then only changes are displayed. If I make those changes using JavaScript function then no need to reload the page. Changes are automatically displays on screen.

How can I change UI dynamically from cpp file without reloading the qml file?

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Dynamic changes on qml page not working through cpp

You shouldn't need to reload a page, which elements are you trying to dynamically update?


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Regular Contributor
Posts: 63
Registered: ‎08-05-2013
My Device: Blackberry-10 webworks
My Carrier: zcon

Re: Dynamic changes on qml page not working through cpp

[ Edited ]
QmlDocument *qml = QmlDocument::create("asset:///InitialRegisterScreen.qml");
qml->setContextProperty("RoamAssist",this);
AbstractPane *root = qml->createRootObject<AbstractPane>();
Sheet *sheet=root->findChild<Sheet *>("RegiSheet");
TextField* textfield = sheet->findChild<TextField*>("ph"); textfield->setText(""); textfield->requestFocus();

//sheet->open();

 Textfield which is present in sheet.

I want to set focus on textfield dynamically, but not able to do it in this way.

Regular Contributor
Posts: 56
Registered: ‎06-25-2012
My Device: non-blackberry user
My Carrier: Airtel

Re: Dynamic changes on qml page not working through cpp

yes BBSJDev is correct just to expand.

 

What you can do is call your http get post in cpp from qml and send a signal to your qml when you get an reponse ,

 

and then in qml you can connect to that signal only and do whatever updates you want to !!

Highlighted
Regular Contributor
Posts: 63
Registered: ‎08-05-2013
My Device: Blackberry-10 webworks
My Carrier: zcon

Re: Dynamic changes on qml page not working through cpp

Sorry coolneo, I am not able to get your suggestion. 
If you have some sample code for this, can you please share it. I am new to blackberry so not able to understand it.

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Dynamic changes on qml page not working through cpp

Hi,

Are you sure you aren't creating a second instance of the Sheet? If you create and show the Sheet in QML, you'll need to find the original instance in C++ code. This thread describes a similar problem:

http://supportforums.blackberry.com/t5/Native-Development/Problem-in-setproperty/m-p/2611947#M49267


Andrey Fidrya, @zmeyc on twitter
Regular Contributor
Posts: 63
Registered: ‎08-05-2013
My Device: Blackberry-10 webworks
My Carrier: zcon

Re: Dynamic changes on qml page not working through cpp

Thanks all of you.....