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
BBSJdev
Posts: 6,089
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Connecting Signal with DelegateControl

The documents say its possible to link a DelegateControl with a signal but for the life of me I cant get it to work and of course there is no example.

 

I believe it should be something like this but doesn't work...

 

Search.qml

 

Container {
    signal searchCancelled()

    id: search

    layout: StackLayout {
        orientation: LayoutOrientation.LeftToRight
    }


    Button {
        id: cancel
        text: "Cancel"

        onClicked: {
            searchCancelled();
        }
    }
}

 

Main.qml

 

Page {
    id: pgDetail

    function cancelSearch() {
        console.log("Search cancelled");
        searchDelegate.delegateControl = false;
    }

    Container {
        layout: StackLayout { }

        ControlDelegate {
            id: searchDelegate
            source: "Search.qml"
            delegateActive: false

            onCreationCompleted: {
                searchDelegate.control.searchCancelled.connect(pgDetail.cancelSearch);
            }
        }
    }
}

 

So the Button shows up when the ControlDelegate is set to active but the signal is never received and the cancelSearch() function never called.

 

Can someone give an example of how to do this as you suggest this is best practice but then give no example of how to work with this control???


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.
Developer
BBSJdev
Posts: 6,089
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: Connecting Signal with DelegateControl

[ Edited ]

Really!

 

Not even any help from the RIM people on here???

 

How about a "no you **bleep** thats not how you do it" or a "thats not possible".


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.
New Contributor
geoidesic
Posts: 9
Registered: ‎12-26-2012
My Device: Q5
My Carrier: Vodacom (Vodaphone)

Re: Connecting Signal with DelegateControl

I totally agree, ControlDelegate is a dud so far. Can't see how to use it except for absolutely static content, which defeats the purpose of using it in the first place!

Please use plain text.
Developer
nareshkodumuri
Posts: 125
Registered: ‎04-28-2012
My Device: BlackBerry 9800
My Carrier: BlackBerry

Re: Connecting Signal with DelegateControl

Hi,

 

Same problem for me also,

What should I do, According to my app design this is the way, but I am unable to update data dynamically.

 

Please reply RIM guys, It is very urgent.

 

Thanks.

 

 

Please use plain text.
Developer
raju504
Posts: 86
Registered: ‎05-21-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: IDEA

Re: Connecting Signal with DelegateControl

For me also same problem.!!! please help me...!

- Raju
Please use plain text.
New Contributor
geoidesic
Posts: 9
Registered: ‎12-26-2012
My Device: Q5
My Carrier: Vodacom (Vodaphone)

Re: Connecting Signal with DelegateControl

I did find a way to do this after all.

Use Connections https://developer.blackberry.com/cascades/reference/qml-connections.html

Your target becomes the id of your ControlDelegate and you are then able to map to its signals.

Please use plain text.
Developer
raju504
Posts: 86
Registered: ‎05-21-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: IDEA

Re: Connecting Signal with DelegateControl

Thank you very much for your reply!!! It will be a great help if you provide a small example on it !!!

 

Thanks!

- Raju
Please use plain text.
Developer
raju504
Posts: 86
Registered: ‎05-21-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: IDEA

Re: Connecting Signal with DelegateControl

When we are trying to do this we are getting the following exception.

 

content: Me {
                         ^, file:///apps/com.app.appname.testDev_sappname9b8dbab6/native/assets//page/Me.qml:70
:9: Connections is not a type
            Connections {
            ^)

 

Do we need to add any library or something for this.

 

Thanks.

- Raju
Please use plain text.
Developer
nareshkodumuri
Posts: 125
Registered: ‎04-28-2012
My Device: BlackBerry 9800
My Carrier: BlackBerry

Re: Connecting Signal with DelegateControl

 

 

   Thank u very much for ur reply.Please provide any sample that u have done.

Please use plain text.
New Contributor
geoidesic
Posts: 9
Registered: ‎12-26-2012
My Device: Q5
My Carrier: Vodacom (Vodaphone)

Re: Connecting Signal with DelegateControl

Try put it in attachedObjects.

Please use plain text.