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
Posts: 24
Registered: ‎12-02-2012
My Device: BB10
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

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!
Contributor
Posts: 24
Registered: ‎12-02-2012
My Device: BB10

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

Thank you Peter!

Contributor
Posts: 24
Registered: ‎12-02-2012
My Device: BB10

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

undefined reference to `bb::cascades::smileytongue:ickers::FilePicker::~FilePicker(),

Need i include some libs in .pro file?

 

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

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

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

Add this to .pro file

LIBS += -lbbcascadespickers
Contributor
Posts: 24
Registered: ‎12-02-2012
My Device: BB10

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

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,627
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
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 Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Contributor
Posts: 24
Registered: ‎12-02-2012
My Device: BB10

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,627
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
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 Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner