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
Bluenoser
Posts: 330
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

signal after page displayed

I know there is onCreationCompleted, but that is before the page is displayed on screen. Is there some other signal than can be used? Or is there something else you can do. I was thinking of just using a QTimer to wait for some small time.

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

Re: signal after page displayed

What are you trying to do as it makes a difference what components you have within your Page which signals you can hook in to.

Without that info and if you are using navigationpane then you could try Pushtransitionended.


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.
Developer
Bluenoser
Posts: 330
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

Re: signal after page displayed

[ Edited ]

I tried what you suggested. It didn't like the onPushTransitionEnded signal.

 

Here is the code:

 

import bb.cascades 1.0
import com.example.addressbook 1.0

Page {
    titleBar: TitleBar {
        id: titleBar
        visibility: ChromeVisibility.Visible
        title: qsTr("Contacts Search")
    }
    Container {
        layout: StackLayout {
            orientation: LayoutOrientation.TopToBottom
        }
        topPadding: 10.0
        Label {
            text: qsTr("Searching your contacts.")
            multiline: true
            horizontalAlignment: HorizontalAlignment.Center
        }
        ProgressIndicator {
            horizontalAlignment: HorizontalAlignment.Center
        }
        ListView {
            dataModel: addressBook.model
            listItemComponents: ListItemComponent {
                type: "item"
                StandardListItem {
                    title: qsTr("%1, %2").arg(ListItemData.lastName).arg(ListItemData.firstName)
                }
            }
            onTriggered: {
                clearSelection()
//               select(indexPath)
//               AddressBook.setCurrentContact(indexPath)
//                AddressBook.viewContact();
//                navigationPane.push(contactViewer.createObject())
            }
        }
    }

    onPushTransitionEnded: {
        addressBook.searchContacts();
    }
    
    attachedObjects: [
        AddressBook {
        	id: addressBook
        }
    ]
}

 Address book is the class from the Address example.

Developer
Bluenoser
Posts: 330
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

Re: signal after page displayed

[ Edited ]

After having my morning caffine, I realized that the onPushTransitionEnded won't work in my code because it needs to be at the NavigationPane level. The problem is that my pages are loaded dynamically and until the page is loaded, it doesn't know how to use the Address class. How can I get put the onPushTranslationEnded at the NavigationPane level and call the Class method when it doesn't know that the Class exists.

 

Actually the page is three levels down in the push.

 

Thanks


Developer
greenmr
Posts: 920
Registered: ‎03-20-2013
My Device: Red LE Developer Z10

Re: signal after page displayed

[ Edited ]

onPushTransitionEnded gets the pushed page as a parameter. Add this to your Page:

 

Page {
   objectName = "MyPage"
function pagePushed() {
addressBook.searchContacts();
} }

Now you can do this on your NavigationPane:

 

NavigationPane {
   onPushTransitionEnded: {
      if ( page.objectName == "MyPage" ) {
         page.pagePushed();
      }
   }
}

You have to use objectName to identify the page type since id: is not accessible from other objects as an attribute.


Bluenoser wrote:

After having my morning caffine, I realized that the onPushTransitionEnded won't work in my code because it needs to be at the NavigationPane level. The problem is that my pages are loaded dynamically and until the page is loaded, it doesn't know how to use the Address class. How can I get put the onPushTranslationEnded at the NavigationPane level and call the Class method when it doesn't know that the Class exists.

 

Actually the page is three levels down in the push.

 

Thanks







Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.