web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Centering object betwe...
Power Apps
Unanswered

Centering object between two other objects

(0) ShareShare
ReportReport
Posted on by 364

Good morning all,

 

Bit of mind boggler this.

 

I have the following little progress bar thing:

Capture.PNG

The bar between the two numbers (Stage1 and Stage2, from left to right) is currently centred using the following code:

 

x = (Stage1.X + Stage1.Width) + (Stage1.Width / 2)
width = Stage2.X - (Stage1.X + Stage1.Width) - (Stage1.Width)

 

Now this means that if I resize the control, the bar adjusts automatically, like below:

 

Capture1.PNG

 

But you can also see that the bar becomes too short to be useful/look any good. So I think I need the width of the bar to be a percentage of the gap between Stage1 and Stage2, and for the X to continue to centre it. 

 

Honestly I'm at a loss on how to do this. Is there anyone better at maths that can help here? Cheers!

Categories:
I have the same question (0)
  • Verified answer
    BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @EpicTriffid ,

     

    With the below you'll have a 10% / 80% / 10% ratio which you adjust by changing the fractions:

     

     

    X = (Stage1.X + Stage1.Width)+((Stage2.X - (Stage1.X + Stage1.Width)) * .1)
    Width = (Stage2.X - (Stage1.X + Stage1.Width)) * .8

     

     

    On top of that you may want to set the Visible property so the control disappears below a certain threshold (in the below example 25):

     

    Visible = Self.Width > 25

     

     

  • EpicTriffid Profile Picture
    364 on at

    Amazing! Thank you!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard