cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
winston_smyth
Helper I
Helper I

image not updating after clicking button

I have an app thats capturing two pictures from the camera.

There are two buttons and two images.

Behind each button is this code:
Button1
ClearCollect(myPhoto,myCam.Photo);
myFaceImg.Image = First(myPhoto).Url;

 

Button2:
ClearCollect(myID,myCam.Photo);
myIDImg.Image = First(myID).Url;

 

Each button should:

- clear the collection and take a picutre from the camera, placing it in the 1st slot in that particular collection.

- populate one of the images with the new photo.

 

I am not seeing this behavior, but am seeing a number of issues:

1. the images do not refresh each time i hit the button. they refresh the first time, then I need to select the camera control before the image will refresh via the button again.

2. The 2nd image is being populated with an image from the first collection, despite clearly being assigned an image from a different collection.

 

Have i misunderstood how buttons in powerapps work?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @winston_smyth :

Could you tell me:

  • Are myFaceImg and myIDImg two image control?
  • Do you want to update the image controls’ image property by select the button?

I assume the above assumption holds

First ,let me explain why you encounter the problem you mentioned.

The point is photo will not be automatically updated (and the OnSelect event of the camera control can not be triggered by other controls).

Secondly, To solve your problem, I suggest you use the stream property to automatically update the camera control’s image.

I’ve made a test for your reference:

1\Camera control(myCam):

StreamRate:

500 /*refresh rate 0.5s*/

OnStream:

true

2\Button1(pay attention: Stream instead of Photo):

OnSelect:

ClearCollect(myPhoto,myCam.Stream);

3\Button2:

OnSelect:

ClearCollect(myID,myCam.Stream);

4\image control1(myFaceImg):

Image:

First(myPhoto).Url

5\ image control1(myIDImg):

Image:

First(myID).Url

I think these links will help you a lot:

Camera control in Power Apps

UX Patterns: Camera Shutter Button

Best Regards,

Bof

View solution in original post

2 REPLIES 2
winston_smyth
Helper I
Helper I

Update:

It appears that a picture cannot be captured from the camera using a button, it has to be done directly in the OnSelect of the camera.
Seems like a bug to me and makes it awkward if i want to take only a set number of pictures.

Hi @winston_smyth :

Could you tell me:

  • Are myFaceImg and myIDImg two image control?
  • Do you want to update the image controls’ image property by select the button?

I assume the above assumption holds

First ,let me explain why you encounter the problem you mentioned.

The point is photo will not be automatically updated (and the OnSelect event of the camera control can not be triggered by other controls).

Secondly, To solve your problem, I suggest you use the stream property to automatically update the camera control’s image.

I’ve made a test for your reference:

1\Camera control(myCam):

StreamRate:

500 /*refresh rate 0.5s*/

OnStream:

true

2\Button1(pay attention: Stream instead of Photo):

OnSelect:

ClearCollect(myPhoto,myCam.Stream);

3\Button2:

OnSelect:

ClearCollect(myID,myCam.Stream);

4\image control1(myFaceImg):

Image:

First(myPhoto).Url

5\ image control1(myIDImg):

Image:

First(myID).Url

I think these links will help you a lot:

Camera control in Power Apps

UX Patterns: Camera Shutter Button

Best Regards,

Bof

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,334)