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
rocjohn
Posts: 24
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.

Please use plain text.
Developer
peter9477
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!
Please use plain text.
Contributor
rocjohn
Posts: 24
Registered: ‎12-02-2012
My Device: BB10
My Carrier: CMCC

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

Thank you Peter!

Please use plain text.
Contributor
rocjohn
Posts: 24
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::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.

Please use plain text.
Developer
borceg
Posts: 670
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
Please use plain text.
Contributor
rocjohn
Posts: 24
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.

Please use plain text.
Developer
borceg
Posts: 670
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.
Please use plain text.
Developer
ekke
Posts: 1,425
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
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Contributor
rocjohn
Posts: 24
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

Please use plain text.
Developer
ekke
Posts: 1,425
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
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.