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
Regular Contributor
sonalb123
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?

Please use plain text.
Developer
BBSJdev
Posts: 5,986
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
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. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Regular Contributor
sonalb123
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.

Please use plain text.
Regular Contributor
coolneo
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 !!

Please use plain text.
Regular Contributor
sonalb123
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.

Please use plain text.
Developer
Zmey
Posts: 1,510
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

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
Please use plain text.
Regular Contributor
sonalb123
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..... :Clap: 

Please use plain text.