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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 27
Registered: ‎12-02-2012
My Device: BB10
My Carrier: CMCC
Accepted Solution

Are there convinient way to show a file selection dialog?

Are there some builtint control/components to show afile selection dialog?

I think, this is a base requirement, but i found nothing in Cascades FrameWork.

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Are there convinient way to show a file selection dialog?

Look here https://developer.blackberry.com/cascades/reference/bb__cascades__pickers__filepicker.html


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 27
Registered: ‎12-02-2012
My Device: BB10
My Carrier: CMCC

Re: Are there convinient way to show a file selection dialog?

Thank you Peter!

Developer
Posts: 27
Registered: ‎12-02-2012
My Device: BB10
My Carrier: CMCC

Re: Are there convinient way to show a file selection dialog?

undefined reference to `bb::cascades:Smiley Tongueickers::FilePicker::~FilePicker(),

Need i include some libs in .pro file?

 

I have #include <bb/cascades/pickers/FilePicker> and qmlRegisterType<bb::cascades:Smiley Tongueickers::FilePicker>("CustomComponent", 1, 0,"FilePicker") in main.cpp.

Developer
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB
My Carrier: Vip

Re: Are there convinient way to show a file selection dialog?

Add this to .pro file

LIBS += -lbbcascadespickers
Developer
Posts: 27
Registered: ‎12-02-2012
My Device: BB10
My Carrier: CMCC

Re: Are there convinient way to show a file selection dialog?

Thank you borceg, now build ok after add LIBS += -lbbcascadespickers in .pro file.

But now qml:72: ReferenceError: Can't find variable: FileType while running.

Developer
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB
My Carrier: Vip

Re: Are there convinient way to show a file selection dialog?

Post more code from your qml in order to help you.
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Are there convinient way to show a file selection dialog?


rocjohn wrote:

Thank you borceg, now build ok after add LIBS += -lbbcascadespickers in .pro file.

But now qml:72: ReferenceError: Can't find variable: FileType while running.


you have to register the Types

// Register some classes for Filepicker for QML
	qmlRegisterType<bb::cascades::pickers::FilePicker>("bb.cascades.pickers", 1,
			0, "FilePicker");
	qmlRegisterUncreatableType<bb::cascades::pickers::FilePickerMode>(
			"bb.cascades.pickers", 1, 0, "FilePickerMode", "");
	qmlRegisterUncreatableType<bb::cascades::pickers::FilePickerSortFlag>(
			"bb.cascades.pickers", 1, 0, "FilePickerSortFlag", "");
	qmlRegisterUncreatableType<bb::cascades::pickers::FilePickerSortOrder>(
			"bb.cascades.pickers", 1, 0, "FilePickerSortOrder", "");
	qmlRegisterUncreatableType<bb::cascades::pickers::FileType>(
			"bb.cascades.pickers", 1, 0, "FileType", "");
	qmlRegisterUncreatableType<bb::cascades::pickers::FilePickerViewMode>(
			"bb.cascades.pickers", 1, 0, "FilePickerViewMode", "");

 

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Highlighted
Developer
Posts: 27
Registered: ‎12-02-2012
My Device: BB10
My Carrier: CMCC

Re: Are there convinient way to show a file selection dialog?

Thanks Ekke!

Very nice, now everything is ok!

 

another help: are there some way to filter just .mp3 files in file selection dialog?

 

:-D

Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Are there convinient way to show a file selection dialog?

you can select music files

title: qsTr("Select Music") + Retranslate.onLanguageChanged
            imageSource: "asset:///images/musicplayer81.png"
            ActionBar.placement: ActionBarPlacement.InOverflow
            onTriggered: {
                picker.title = qsTr("Select Music")
                picker.type = FileType.Music
                picker.directories = [
                ]
                picker.open();
            }

 

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner