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
Highlighted
Developer
Posts: 45
Registered: ‎11-16-2013
My Device: Z10
My Carrier: AT&T

Re: Paste Text In Clipboard

@marcossit

 

Thanks man!

 

But I know how to copy.

I need paste from Clipboard.

Developer
Posts: 45
Registered: ‎11-16-2013
My Device: Z10
My Carrier: AT&T

Re: Paste Text In Clipboard

Wait Help ~Smiley Happy

Developer
Posts: 45
Registered: ‎11-16-2013
My Device: Z10
My Carrier: AT&T

Re: Paste Text In Clipboard

No one knows how it's done?!

Developer
Posts: 45
Registered: ‎11-16-2013
My Device: Z10
My Carrier: AT&T

Re: Paste Text In Clipboard

Plz Help

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

Re: Paste Text In Clipboard

I'd love to help you but I still don't quite understand what you are trying to achieve, sorry.

Which bit is not working for you, putting text in the clipboard or retrieving it?

Your example seems to show you copying a Labels text property to the clipboard, is that what you want to do?

Maybe a list of steps with what you want to do with the step that isn't working indicated may help us understand?


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: 45
Registered: ‎11-16-2013
My Device: Z10
My Carrier: AT&T

Re: Paste Text In Clipboard

@BBSJdev

 

Thanks!

 

Sorry if not explained well.

 

I made this app to test copy and paste text to another apps.

Copy the text worked, but the paste does not work.

The problem now is to paste the text from the clipboard.

Example:

When I copy email from BB hub then I go to my app and I click the paste I need paste the email in TextArea or label.

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

Re: Paste Text In Clipboard

Okay, well I've just quickly written this and it works for me...

 

Clipboard.qml

import bb.cascades 1.2
import custom.lib 1.0

import "controls"

RecipePage {
    RecipeContainer {
        Button {
            text: "Paste clipboard contents"
            onClicked: {
                ta.text = clip.text;
            }
            
            attachedObjects: [
                Clipboard {
                    id: clip
                }
            ]
        }
        TextArea {
            id: ta
        }
    }
}

 

Where the Clipboard object is defined as such,

 

Clipboard.h

#ifndef CLIPBOARD_H_
#define CLIPBOARD_H_

#include <QObject>

class Clipboard: public QObject {

	Q_OBJECT
	Q_PROPERTY(QString text READ text)

public:
	Clipboard();
	virtual ~Clipboard();

	QString text();
};

#endif /* CLIPBOARD_H_ */

 Clipboard.cpp

#include "Clipboard.h"

#include <bb/system/Clipboard>

Clipboard::Clipboard() {
	// TODO Auto-generated constructor stub

}

Clipboard::~Clipboard() {
	// TODO Auto-generated destructor stub
}

QString Clipboard::text() {
	bb::system::Clipboard clipboard;
	QByteArray data = clipboard.value("text/plain");
	if (!data.isEmpty()) {
	    // process data from clipboard
		return QString::fromAscii(data, data.size());
	}

	return "";
}

 

Hope that helps.

 


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: 45
Registered: ‎11-16-2013
My Device: Z10
My Carrier: AT&T

Re: Paste Text In Clipboard

@BBSJdev

 

Thanks!

 

But does not work.

And when click the Button do not show any error.

 

Qml debugging is enabled. Only use this in a safe environment!
OrientationSupportPrivate::getSupportedDisplayOrientation:  auto 
OrientationSupportPrivate::initDirectionAndOrientation: 
CS Debugging enabled: false 

 

 

Why add "Clipboard" in attachedObjects?

Can you make a project?

 

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

Re: Paste Text In Clipboard

[ Edited ]

Here you go...


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: 45
Registered: ‎11-16-2013
My Device: Z10
My Carrier: AT&T

Re: Paste Text In Clipboard

@BBSJdev

 

Thanks man.

 

My problem was in applicationui.cpp