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
Developer
citrinetiger
Posts: 55
Registered: ‎12-04-2012
My Device: Q10
Accepted Solution

Share a (selective)screenshot

Hi all!

I'm trying to share a screenshot within my app but I am experiencing some expected behavioral issues that I'm not sure how to avoid:

Is there a way to take a 'selective' screenshot? Basically I am trying to avoid sending a screenshot with the Nav Bar included

And is there a way to send a screenshot without storing a copy on the phone?

Any help would be greatly appreciated, thanks!

-Ali
Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

Re: Share a (selective)screenshot

[ Edited ]

I made a sample that demonstrates how to do this using 10.0 api's & no screenshot permission

 

https://github.com/slashkyle/Cascades-Samples/tree/master/CaptureThis

 

the size of the image is set in main.qml on the buttons onClicked function

Developer
citrinetiger
Posts: 55
Registered: ‎12-04-2012
My Device: Q10

Re: Share a (selective)screenshot

Great, thanks Kyle! I will give it shot :smileyhappy:
-Ali
Developer
citrinetiger
Posts: 55
Registered: ‎12-04-2012
My Device: Q10

Re: Share a (selective)screenshot

Hi Kyle, I have tried to import your sample app into Momentics but it won't recognize it as a project. I know it must have a simple fix but can't seem to get it :/

Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

Re: Share a (selective)screenshot

did you download it or are you trying to pull it directly from github

 

It should recognize it, I would suggest downloading the zip extracting it and then trying to locate the project that way

Developer
citrinetiger
Posts: 55
Registered: ‎12-04-2012
My Device: Q10

Re: Share a (selective)screenshot

[ Edited ]

Thanks for your help Kyle. I was able to load the CaptureThis app that you provided in the link but the 'Click to Capture' button gives the following error when pressed:

 

"asset:///main.qml:56: ReferenceError: Can't find variable: CaptureThis"

 

I checked the .cpp file and all looks good so I'm confused

QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);


    qml->setContextProperty("CaptureThis", this);

    // create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();
    // set created root object as a scene
    app->setScene(root);

 

 

any ideas? 

 

Thanks 

-Ali

Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

Re: Share a (selective)screenshot

sorry about that it appears there may be an error there, there's a working version attached

 

also when importing projects be sure to clean them before trying to build/run

 

 

 

 

Developer
citrinetiger
Posts: 55
Registered: ‎12-04-2012
My Device: Q10

Re: Share a (selective)screenshot

[ Edited ]

the downloaded attachment worked like a charm! :smileyhappy:

 

While it doesn't solve both of my issues I think it does solve the more complicated of the 2 so I'll mark your generous assistance as the solution!

 

It's way better than what I came up with originally:

ImageButton {
            defaultImageSource: "asset:///images/share.png"
            
            onTouch: {
                take a selective screenshot;
                Share said Screenshot;
                delete said screenshot;
            }
        }

 just kidding of course. I will tinker with it and post the final snippet as soon as I figure it out.

 

I thank you for your help, I downloaded 'TextNGo' and will give it a positive review tomorrow :smileyhappy:

-Ali

 

Developer
bcs925
Posts: 262
Registered: ‎07-13-2012
My Device: PlayBook, DA B, DA C, LE Z10 #102, Q10, Z30

Re: Share a (selective)screenshot

Slashkyle, your screenshot sample works great! Is there any way to only capture portion of the screen with it? if I change the height/width it just distorts the full screen to a smaller size. Thoughts?

---
Check out my BB10 Cascades Coding site: BBcascades.com & Cascades Blog: bbcascadescode.tumblr.com

My Built for BlackBerry app: The Dive Plan