cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Zeekoe
Regular Visitor

Potential bug? Gallery controls in component default to width=1

Hi everyone

 

I'll start off with providing some context. We're currently working on a project with multiple developers for about a month. As co-authoring isn't yet available in our region, we decided to work with shared component libraries. The idea being that everyone works on his/her own component and subsequently we merge all the components in one master-application.

 

One component contains a vertical gallery to display tabular data with various controls/fields per row. Within the shared component, everything seems to be working fine. All the "X" and "Width" properties of the rowcontrols/fields are defined relative to the headercontainers.

Zeekoe_0-1638520090769.png

So far, so good. However, upon importing the library component into an actual PowerApp, everything in the gallery shifts to the left. Trying to figure out why this happened, we edited the component locally (so within the PowerApp) and observed all the widths of the rowcontrols/fields being reset to 1.

Zeekoe_1-1638520536585.png

Has anyone encountered this issue as well? If so, do you know a way to fix it or is this a bug on PowerApps' side?

Thanks in advance!

6 REPLIES 6
Ramole
Super User
Super User

Hi @Zeekoe 

Use X of the label overlapping this code 

Parent.TemplateWidth - Self.Width - 5
Thank you
If this post helps, then Click on the Thumbs Up below. and Accept it as the solution . to help others find helpful.
LukasKo
Advocate I
Advocate I

This controls shrinking to the width 1 happens to me also sometimes. Usually when I use controls in kind of 'unsupported' scenario. For example when I used nested gallery (in depth 2) in canvas control, every time I forgot myself and tried to move some nested gallery control by drag and drop, all gallery elements were reset to the width 1. Or when I set for the control in gallery Y coordinate to negative number, then when I copy the gallery, it's  reset either to 0 or sometimes to 1. 

  Actually it's a good trick for another scenarios, when for example the horizontal gallery template size is set to 1, X and Y coordinates for child elements are related to Gallery control X, Y and not to the gallery cell, so it's possible to display gallery objects irregularly. 

  Maybe you could check TemplateSize/TemplateWidth property of gallery in your component, in case it's calculated if you have correct values in render time.

Zeekoe
Regular Visitor

Hi Ramole

Thanks for your response! However if I understand your suggestion correctly, changing the .X-property of the overlapping labels wouldn't lead for the desired effect.
To clarify; imagine the Parent.TemplateWidth being 1000 and there are 5 labels, each having a .Width of 200. I'd like label1.X to be 0 and label1.Width to be 200; label2.X would then be200 and label2.Width would be 200, etc. (but rather than hardcoding it to 200, it receives its values from containers in the header above). If I understand you correctly, label1.X would be (1000-200-5=) 795, same for label2.X, label3.X etc.

Please do tell me if I missed something in your explaination!

Zeekoe
Regular Visitor

Hi LukasKo

 

I appreciate you input! I did some more testing based on your experiences, unfortunately without finding a real solution. The .TemplateWidth property of the gallery is set to Parent.Width and not used by any of the child controls inside the gallery. I did test the following cases though:

  • Setting the .Width property of the controls to a fixed number, rather than as a reference to the .Width property of a container in the header (.X of the control is still relatively defined). Result: controls still shift to the left
  • Setting the .X property of the controls to a fixed number, rather than as a reference to the .X property of a container in the header (.Width of the control is still relatively defined). Result: controls still shift to the left
  • Setting both the .Width and .X property of the controls to a fixed number, rather than as a reference to the .Width and .X property of a container in the header. Result: controls keep locked in place.

Based on this outcome, I presume the .X and .Width properties get (temporarily) reset when inserting a component onto a canvas app. Is this in line with your experience LukasKo?

LukasKo
Advocate I
Advocate I

Hi @Zeekoe , 

 

 I've browsed my components to find similar one to yours. I've found one, but I don't use there horizontal and vertical container controls, only standard container. 

LukasKo_0-1638998105690.png

I don't have any problems with shifting controls to the left, but it's maybe because I have icon and text positions as input parameters because I wanted them to be configurable. But the width is calculated and it's working as expected.

 

Container2.Width = Parent.Width

Gallery1.Width = Parent.Width - 20

btnTitle.Width = Parent.Width

 

 

Zeekoe
Regular Visitor

Hi @LukasKo 

 

I think our cases differ a bit too much; I did manage to recreate the issue on a different tenant by applying the following steps:

  1. Create a shared component library with one vertical container
  2. Within the vertical container, insert a horizontal container and a blank vertical gallery
  3. Fill the horizontal container with multiple 'normal' containers (= this is the header)
  4. Create an input property (table) for the component and reference this input property in gallery1.items
  5. Insert some labels/other controls in the vertical gallery and set the .X and .Width properties of each label to a different container. f.i. Label1.X would be equal to Container4.X, Label1.Width would be equal to Container4.Width, etc.
  6. Create a blank canvas app and insert the shared component library. As soon as I change the name, or one of the input properties of the component, the shift to the left occurs.

Do you now reach a similar result?

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (2,704)