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: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

how to arrange UI BB-10

[ Edited ]

Hello,

 

I want to ask an opinion of community here.

 

I am developing a BB-10 app which has more or less forllowing UI structure.

In my app I will need probably one navigation object (e.g., NavigationPane).

Users must then be able to open different windows/dialogs inside this NavigationPane

(e.g., stack like structure).

 

What I am thinking to do is have one instance of NavigationPane class throughout

whole application, e.g., NavigationPane* mRoot;

 


For each page that a user may open inside this NavigationPane, I want to

have a separate class which will probably inherit from Page. e.g.,

userDetailsPage (inherits from Page)

settingsPage(inherits from Page), etc.

 


Now, when the user clicks some button on the app. I want corresponding

page to be displayed in the NavigationPane.

This I will do by invoking a function for example from my main class which will

call smth like: mRoot->push(mNewPage);

 

My question is following: do you think it is ok to have an architecture like this?

One challenge that remains with me and I don't know yet how/or whether it is possible to do it is following.

I want each my custom page, to have a corresponding .qml file

which will show when my page is added to the NavigationPane.

How and where should I add this functionality? (In the constructor of my custom Page??).

 

This way I want also to be able to set up an interaction between my custom Page

class object and the .qml file (e.g., maybe store data objects in the class object and

access from QML).

 

Do you think if such an architecture is doable within Cascades? Thanks.

 

 

 

 

 

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

Re: how to arrange UI BB-10

[ Edited ]

More than doable, recommended I would say.

 

The architecture you have specified is more or less the one used in the cookbook I suggest you download that and see just how simple it is to do what you describe.

 

http://developer.blackberry.com/cascades/sampleapps/

 

The secret sauce is the use of ComponentDefinition.

 

Good luck with your app.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Re: how to arrange UI BB-10

[ Edited ]

Hi, this looks very similar thanks.

Let me ask you one more question and it would be nice if you could give some tipps.

 

This looks very similar just in this sample everything is done in C++.
In my case I am thinking to use bit of QML. So, let's takle for example

the ButtonRecipe c++ class from the cookbook sample which is used just

to show some button functionalities and which inherits CustomControl.

This class does all in cpp, UI, implementation etc.

 

In my case, I would like to have three files basically:

buttonRecipe.cpp (which could implement the logic, have some functions

accessible via QML etc.), buttonRecipe.h, and buttonRecipe.qml -- which would

do the UI. So, how do I tie the buttonRecipe.qml to the buttonRecipe.cpp such

that when the .cpp file loads, the qml file is shown? Thank you.

 

ps. I know how to expose the buttonRecipe.cpp to the buttonRecipe.qml then later on

so that I could use cpp functionality from QML if needed.

 

Thank you in advance once again.

 

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

Re: how to arrange UI BB-10

[ Edited ]

Actually if you look again you'll see there are two versions of the cookbook one that uses C++ and the other in QML.

 

So there is really no point me re-inventing the wheel when a QML example exists already for you to adapt.

 

If you have a question about QML/C++ integration then please close off this thread by accepting this post as the solution and then searching for the many other threads that have already asked this question or read this...

 

http://developer.blackberry.com/cascades/documentation/dev/integrating_cpp_qml/

 

 

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Re: how to arrange UI BB-10

[ Edited ]

Hi, thanks- I am not reinventing the wheel, I mentioned ButtonRecipe class as an exmaple, of course in my case

there will be a different class. I think I basically must figure out how to embed a QML file into a CustomComponent (or a  c++ class that inherits from Page). And maybe some other things. Anyway, thanks, I will go through it tomorrow once again, ask some more questions if I have -- and otherwise accept the solution if all is ok.

 

ps. forgot to mention - thakns for the links anyway, I think they maybe helpful, just those are like two extremes: one is completely c++ based,  another completely QML based.

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

Re: how to arrange UI BB-10

[ Edited ]

I think when you do you'll see that it answers your original post, giving an example of how to do dynamic pages and how QML and C++ can interact together. The selectioncheckbox being just one example.

 

Best of luck.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.