Is there a way to access the name of a control?
I could be totally off here, and there is another way to this, to access the name of a control?
Apologies if I misunderstand you, but it seems like you're not only trying to get to a common property across multiple controls but also trying to reference a relative property of a control within one of it's properties - I'm not sure how you can do it the way you're trying to do it as I've never come across anything like a master object model you can navigate in PowerApps, including being able to reference a this instance of a control.
You can set all the control's X property to the same variable and then manipulate that, but if the manipulation also needs to reference a property of that specific control then I'm stumped.
so, eg: variable for property X;
To manipulate the X value for all these controls, you can then use UpdateContext() - so;
will update the X property for all controls that have it, regardless of their name - but if you want "value" to be dependent on something within each specific control and therefore different for each control, (like the length of the text in that control), then I don't think you can reference it dynamically.
Will watch this thread with interest 🙂
@RusselThomas, thanks for the thoughtful reply. I actually think I made a mistake in my original post...
The goal is:
I had "+" in the original post rather than " * ".
You could imagine: This would be a fast way to build a grid of items on the screen. Without this, you have to go into each Control and set the X Property of EVERY ONE like this:
Is there another way to self-reference a Control?
Not that I'm aware of 😞
Even in galleries, pre-populated controls that use auto-height/auto-spacing are rendered with the absolute name of the relative control it's being spaced from - and PowerApps doesn't accept strings as object references, so I'm really not sure it's possible.
Sorry I couldn't help - perhaps someone else knows a way, but if it turns out to be impossible, perhaps consider logging an idea on the Ideas forum? 🙂
@seadude, it sounds like you want to duplicate controls and have their position respond according to their name.
This sounds like a use case for a gallery 🙂
Whenever you think of duplicating things, think of the gallery. There's a few ways to go about this, I'll share an interesting one.
Create a table with a column that specifies the X location you want.
Insert a control--we'll call it sombrero.
Set the X property of sombrero to the column that has the X location.
Repeat for Y if you want.
Set the TemplateSize of the Gallery to 0.
The position of the object will be relative to the dimensions of the gallery. You can do a lot of creative things this way.
Join us for the next call on August 17, 2022 at 8am PDT.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.