cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gorilla_8
Super User
Super User

MOVE GALLERY WHEN I SELECT A ICON

There is a way to move a label and a gallery to move the X and Y?

 

GALLERY 1.png

 

I like to remove this space empty between the gallery and the dropdown "todos"

 

In this one:

 

GALLERY 2.png

 

I like to remove the empty space between the gallery and the txtinput: "nome do recurso"

 

GALLERY 3.png

 

In this one, I would like be like this.

 

Thanks guys, for the help!

9 REPLIES 9
Pstork1
Dual Super User
Dual Super User

If you set the Y property of the gallery to point at a variable and then change the value of the variable when you click on the icon it will move the gallery to that location.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Thanks for the response @Pstork1. But are three different spots, so I make three different variables?

The point is that it will move to whatever value is set for the variable.  So its a matter of either a switch statement in the icon or nested If() statements to set the variable.  The concept is the same.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @Pstork1 , thanks, but I don't get it. Thank you

I'm not sure how better to explain it.  The point is that the placement of the Gallery will correspond to whatever value is in the variable.  So if the variable is set to 64 then the top of the Gallery would be up towards the top of the screen.  But if the value of the variable is set to 256 the top of the Gallery would be much farther down the page. So set the value of the variable based on clicking a specific icon or some other logic and the Gallery will move.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi, if you read my post, I said I have one icon and thrre different positions, how I do that

So when you click on the icon what factors determine the correct position?  If you click on the same icon there has to be something that tells you where you want to position the gallery.  You have to use those factors in a switch() or nested iF() to set the variable.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Ok, I understand that @Pstork1 . But how he can move in different location when I click on icon?

On the icon, set the OnSelect property to update the variable you are using for the Y coordinate.

Example:
On the OnSelect of the Icon, set this:
UpdateContext({varY: 100})

Now, set the gallery’s Y value equal to this:
If(varY in [Blank()], 0, varY)

This basically gives your Y coordinate for the gallery a default position until someone clicks the Icon. In this example, the default position is 0 but you could change that to whatever.

That’s the most basic way. You will need to determine the logic you want for multiple positions.

Here is an example of using 3 positions:

For example, you might want to have the icon’s OnSelect statement like something like this:

If(

varY in [Blank(), 0],
UpdateContext({varY: 64}),

varY in [64],
UpdateContext({varY: 100}),

varY in [100],
UpdateContext({varY: 0})
)


This is basically saying if the variable is unknown or 0 when the icon is clicked, set the the value to 64.

If the variable is 64 when the icon is clicked, set the value to 100.

If the variable is 100 when the icon is clicked, set the value to 0.

Again, these are just examples. You could change the 0, 64 and 100 to any value you wanted. Or you could even set them relative to another control, eg Label1.Y + Label1.Height would position the variable just below a label.

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.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

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 (4,844)