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
Posts: 112
Registered: ‎10-10-2010
My Device: Torch
My Carrier: Verizon
Accepted Solution

How to add options in second Dropbox from selecting of first Dropbox?

How can I add option(s) to a second dropbox when the onSelectedIndexChanged is triggered on the first dropbox? I tried several methods but to no avail. Is there a way to do it? I'm using both dropboxes on a single page.

 

Thanks guys.

______________________________________________
Android dev jumping ship to BB. Cascade newbie. Any help would be great. Miss the Visual Basic days.

Updated my pin
Retired
Posts: 32
Registered: ‎05-09-2012
My Device: BB10
My Carrier: None

Re: How to add options in second Dropbox from selecting of first Dropbox?

[ Edited ]

Hi there, 

 

What have you tried? It looks like the DropBox add() methods should do it, are they not working?

 

Cheers, 

Daniel

 

 

Developer
Posts: 112
Registered: ‎10-10-2010
My Device: Torch
My Carrier: Verizon

Re: How to add options in second Dropbox from selecting of first Dropbox?


danielrr5 wrote:

Hi there, 

 

What have you tried? It looks like the DropBox add() methods should do it, are they not working?

 

Cheers, 

Daniel

 

 


Yes I have. I read over it cerefully. Maybe I'm not doing it right. I'm a cascade newbie afterall. I'm just trying to populate a second dropdown from the selection of the first dropdown within the same page all within the QML code.

 

I'm learning cascades because of the down right speed one can make an app. Also, it supports XML such as populating dropdrowns and lists. Something I will look forward to working with later on with my XML background. But right now I'm just focusing on QML itself. Any help would be very useful to this newbie.

 

Thanks,

Cozz

 

 

______________________________________________
Android dev jumping ship to BB. Cascade newbie. Any help would be great. Miss the Visual Basic days.

Updated my pin
Retired
Posts: 32
Registered: ‎05-09-2012
My Device: BB10
My Carrier: None

Re: How to add options in second Dropbox from selecting of first Dropbox?

Cozz, 

 

The methods that don't have Q_INVOKABLE in front of them are not callable from QML so you'll need to do this in C++ for now. I have tried them and can confirm they work properly.

 

Let me know if there is anything else I can do for you.

 

Regards, 

Daniel

Developer
Posts: 112
Registered: ‎10-10-2010
My Device: Torch
My Carrier: Verizon

Re: How to add options in second Dropbox from selecting of first Dropbox?


danielrr5 wrote:

Cozz, 

 

The methods that don't have Q_INVOKABLE in front of them are not callable from QML so you'll need to do this in C++ for now. I have tried them and can confirm they work properly.

 

Let me know if there is anything else I can do for you.

 

Regards, 

Daniel


Ahhh....now I understand. I wonder if there will be any change to this in the future. But all is well. I'll be calling it with C++ then.

 

Thanks m8.

______________________________________________
Android dev jumping ship to BB. Cascade newbie. Any help would be great. Miss the Visual Basic days.

Updated my pin
Retired
Posts: 32
Registered: ‎05-09-2012
My Device: BB10
My Carrier: None

Re: How to add options in second Dropbox from selecting of first Dropbox?

My pleasure. Let me know if there is anything else I can do for you.

Daniel
p.s. I have marked the thread as Solved.
Developer
Posts: 112
Registered: ‎10-10-2010
My Device: Torch
My Carrier: Verizon

Re: How to add options in second Dropbox from selecting of first Dropbox?

Daniel, a stupid question

Would it be better off to simply write the code fully in C++? I pretty much loose the lisual aspect of it. Something I very much enjoy. I've been questioning as to how to implement this and I have not figured how to update the second dropdown yet have set all the components in QML then using C++ to update the lists. If you still have the coding that you say has worked for you then its worth gold to me right now lol.

 

Thanks,

Cozz

______________________________________________
Android dev jumping ship to BB. Cascade newbie. Any help would be great. Miss the Visual Basic days.

Updated my pin
Retired
Posts: 32
Registered: ‎05-09-2012
My Device: BB10
My Carrier: None

Re: How to add options in second Dropbox from selecting of first Dropbox?

Writing the code fully in C++ or not is up to you. My personal preference is to write as much in QML as possible and augment with C++ where the framework falls short. Remember this is still a beta framework so expect to have to write a few work arounds here and there Smiley Happy

 

I'll provide a few code samples ASAP.

 

Cheers, 

Daniel

Retired
Posts: 32
Registered: ‎05-09-2012
My Device: BB10
My Carrier: None

Re: How to add options in second Dropbox from selecting of first Dropbox?

Cozz, attached is a sample app that shows how I've done it. Let me know if it resolves your issue.

 

It's relatively straightforward but don't hesitate to ping me if you have any questions about it.

 

Regards, 

Daniel

Developer
Posts: 112
Registered: ‎10-10-2010
My Device: Torch
My Carrier: Verizon

Re: How to add options in second Dropbox from selecting of first Dropbox?


danielrr5 wrote:

Cozz, attached is a sample app that shows how I've done it. Let me know if it resolves your issue.

 

It's relatively straightforward but don't hesitate to ping me if you have any questions about it.

 

Regards, 

Daniel


Thanks so much m8. It's been a big help. I went through your code and compared it to mine and the first thing that caught my eye was "import com.acme.utils 1.0"

 

I can see it's for what's in attachedObjects....

 

       ThingsThatShouldBeAvailableinQml {
       id: utils
       }

 

But I'm getting an error for the import. I commented (//) the import and what was in attachedObjects and no more errors. It loads fine but I'm back the my original issue, it doesn't populate the second dropdown.

 

So how do I get com.acme.utils 1.0 in there? All this time and all I needed was to import this?

 

Thanks again. I owe you a beer! Also, I don't know how to ping you.

______________________________________________
Android dev jumping ship to BB. Cascade newbie. Any help would be great. Miss the Visual Basic days.

Updated my pin