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
Contributor
ujkhatri
Posts: 26
Registered: ‎08-13-2013
My Device: Developer
My Carrier: Developer
Accepted Solution

file structure

Hi,

 

It is a very basic question but i had to ask.

i am from iOS in which there was a .h and .m file for every xib file.

In blackberry instead of xib for UI we have qml.

can anyone please tell me that how to decide that how many .hpp, .h and .cpp files should be created?

I mean how the number of  qml and .hpp,.cpp,.h files are related? 

Please use plain text.
Developer
simon_hain
Posts: 16,010
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: file structure

if you create a new basic cascades project you have all the hpp/cpp files you need. you can create as many qml files without adding any hpp/cpp files.
only when you want to add new functionality on the native code side.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Contributor
ujkhatri
Posts: 26
Registered: ‎08-13-2013
My Device: Developer
My Carrier: Developer

Re: file structure

Thanks for reply, but what is the standard practice to decide, when and why we should create .c or .h files?

Please use plain text.
Developer
simon_hain
Posts: 16,010
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: file structure

As long as you change only the UI there is no need to do so.

But some functionalities may not be available in QML, and while you could put them all in applicationUI.cpp this may get a bit unhandy after a time.

To give you some examples i have created an own class for my database access, PersistenceService.cpp, one for web access (DataService.cpp) etc.
I also have materials which are all in their own class.
Theoretically you could put everything into a single file.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Contributor
ujkhatri
Posts: 26
Registered: ‎08-13-2013
My Device: Developer
My Carrier: Developer

Re: file structure

Thanks a lot, Simon!! :smileyhappy:
Please use plain text.