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
sbeeckma
Posts: 20
Registered: ‎10-09-2010
My Device: Bold 9700
Accepted Solution

Repainting a page to update all the Labels in it

Hi, I've got a main Page inside a NavigationPane. When I change something using DropDowns in a Settings Page, and I pop() the Settings Page, I go back to the main Page but the values of the main Page (stored in QSettings) aren't updated.

 

How can I force the main Page to redraw itself using the updated values from the Settings page? Or do I really have to exhaustively set the text properties of each Label in the main Page?

Please use plain text.
Contributor
adamlu
Posts: 14
Registered: ‎11-19-2012
My Device: 9900, BB10 Simulator

Re: Repainting a page to update all the Labels in it

I am also wondering if there is a way to get a qml page/component to refresh itself.

 

Anyone knows the answer?

Please use plain text.
Developer
ekke
Posts: 1,515
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Repainting a page to update all the Labels in it


sbeeckma wrote:

Hi, I've got a main Page inside a NavigationPane. When I change something using DropDowns in a Settings Page, and I pop() the Settings Page, I go back to the main Page but the values of the main Page (stored in QSettings) aren't updated.

 

How can I force the main Page to redraw itself using the updated values from the Settings page? Or do I really have to exhaustively set the text properties of each Label in the main Page?


one way could be:

 

create a function in your main page like

function setValues() { ..... }

place all your settings-code i to this function

first time from onCreationCompleted() in your main page call this function to set all the values

 

later.....

from your pushed Page where you change values:

the parent page should be known with unique ID's sao something like

mainPage.setValues() should work

 

or you use signals from your settings page

 

...only some ideas without knowing your exactly situation or use-cases

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
i68040
Posts: 59
Registered: ‎02-05-2012
My Device: Q10

Re: Repainting a page to update all the Labels in it

I'm having issues with both solutions presented and am unable to refresh a parent page in a NavPane:

 

- If I give the page an ID and try to reference the function directly from the next deeper page, the ID is unrecognized in the next deeper pane

- If I try a signal/slot approach it fails silently. The signal is defined at the Navpane level and is referenced as NavPaneId.signalName when I connect / use it.

 

Any suggestions?

Please use plain text.
Developer
i68040
Posts: 59
Registered: ‎02-05-2012
My Device: Q10

Re: Repainting a page to update all the Labels in it

I just found a work-around that does the job:

 

- Make sure that all your pages in the NavPane have a refresh function at the Page level

- In the NavigationPane, create an onTopChanged signal handler

- This signal handler gives you a page reference of the new page that is on the 'top' of the stack

- Call page.refresh() from within onTopChanged

 

Now when I go 'back' in the navpane, the previous page reflects the changes that were just made. This works for me since I commit to SQLite and my 'refresh' functions just pull the most current data out of the DB.

Please use plain text.