PhotonUI icon indicating copy to clipboard operation
PhotonUI copied to clipboard

Expander strange behavior when inside a Window

Open MangelMaxime opened this issue 8 years ago • 5 comments

I took the same code as from Photonui expander's doc and put it inside a window.

The behavior is strange because the expander are not stacked together and split the space at 33% each.

screenshot from 2016-11-20 21-53-58

Here is my code:

JavaScript:

var photonui = require('photonui');

var win = new photonui.Window({
	visible: true,
	fullscreen: true,
	closeButtonVisible: false,
	child: new photonui.BoxLayout({
		orientation: "horizontal",
		children: [
			new photonui.BoxLayout({
			    horizontalPadding: 10,
			    verticalPadding: 10,
			    spacing: 10,

			    children: [
			        new photonui.Expander({
			            title: "Expander 1",
			            child: new photonui.Label({
			                text: "Never gonna..."
			            })
			        }),
			        new photonui.Expander({
			            title: "Expander 2",
			            folded: true,
			            child: new photonui.Label({
			                text: "... give you..."
			            })

			        }),
			        new photonui.Expander({
			            title: "Expander 3",
			            folded: true,
			            child: new photonui.Label({
			                text: "... up!"
			            })
			        })
			    ]
			})
		]
	})
});

My CSS: (should not interfere)

html, body {
    margin: 0;
    width: 100%;
    height: 100%;
}

Possible solutions:

Here are the css rules that I find controlling this behavior:

  • Disable: height: 100%; from top BoxLayout element.
  • Disable: flex-grow: 1; from .photonui-boxlayout > .photonui-boxlayout-item

I just give this possible solutions like that but I didn't think about their usage.

MangelMaxime avatar Nov 20 '16 20:11 MangelMaxime

Can you try adding stretchToParentHeight: false to the BoxLayout's options that is holding the expanders?

I'm pretty sure the behavior you are experimenting is related to BoxLayout and not Expanders.

Breush avatar Nov 20 '16 21:11 Breush

Adding stretchToParentHeight: false does nothing.

And you are probably reason about the behavior being related to BoxLayout because I tried to use BoxLayout to structure my app and I gave the same behavior whenever the BoxLayout is going taller.

MangelMaxime avatar Nov 20 '16 21:11 MangelMaxime

Just to complete, if we replace the Expander by Menu + SubMenuItem the behavior is correct.

MangelMaxime avatar Nov 20 '16 22:11 MangelMaxime

Well, I just noticed that you have two BoxLayouts. Set stretchToParentHeight: false to both (or just the outermost one), and it should fix the issue.

You also might not need the horizontal box, or should use a GridLayout if you have a complex UI to design.

Breush avatar Nov 21 '16 14:11 Breush

Ok so I needed to put stretchToParentHeight: false on the outermost BoxLayout.

And yes, should probably try to use the GridLayout but I am not sure if this would make cleaner or not the GUI. Nevermind, thanks for your help @Breush

I let you close this issue if you think that the current behavior is OK.

MangelMaxime avatar Nov 21 '16 15:11 MangelMaxime