best way to show / hide shapes in a layout?

Find and share HowTos to various installations / configurations!
5 posts • Page 1 of 1
tpjctrl
Posts:145
Joined: Tue May 08, 2018 10:30 am

best way to show / hide shapes in a layout?

Post by tpjctrl »

I've got a layouted panel which holds a bunch of combo boxes and text fields. Depending on what's selected in the combo boxes, some text fields are hidden / shown, what's the best way to handle this so that the layout adjusts correctly? from what I gather changing visibility for shapes isn't the best idea, should I simply add / remove symbol instead or is there some other trick in the layout to achieve this?

Regards,
Tom

tpjctrl
Posts:145
Joined: Tue May 08, 2018 10:30 am

Re: best way to show / hide shapes in a layout?

Post by tpjctrl »

Just to add to this, what I wanted to achieve is a layout which expands / shrinks when a new shape is added / removed into the layout. Expanding works fine when a new symbol is added, but when this newly added symbol is removed, there's no "shrinkage". Is it possible to somehow force the panel to shrink down to the minimum possible size (which is dictated by what's initially on the panel as some elements are "fixed" policy and thus limit how small the panel can go)?

Also, is it possible to add a simple shape (like a textfield, combobox etc) to a layout rather than using addSymbol which then requires a shape to be made into a panel_ref to be added in with addSymbol?

Cheers,
Tom

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: best way to show / hide shapes in a layout?

Post by leoknipp »

When changing the objects used in layouts you can disable the layout before doing the modification by using the panel attribute "layoutEnabled".
After all changes are made the layout is enabled again.

According to the documentation it is not possible to add a shape to a layout.

Best Regards
Leopold Knipp
Senior Support Specialist

tpjctrl
Posts:145
Joined: Tue May 08, 2018 10:30 am

Re: best way to show / hide shapes in a layout?

Post by tpjctrl »

Thanks Leopold, I forgot about this question.

Just to clarify, here's what I'm trying to achieve:

- create a simple horizontal layout, with two buttons, one next to each other
- first button adds an object ref to the layout via addSymbol
- second button removes the object ref from the layout via removeSymbol

When you run the above, here's what happens:
- click first button, the panel expands to accommodate the newly added object ref
- click the second button - object ref is removed, but panel doesn't automatically resize back down to original size

How does one force the "resize back down to original size" of the layout? I can manually resize the window down, but I was looking for an automatic method. There is one via get layout minimal size and self.size, but I'm having issues with it on more complicated embedded layouts and modules where you end up with a panel that can be resized down to just the window bar on the top.

gschijndel
Posts:376
Joined: Tue Jan 15, 2019 3:12 pm

Re: best way to show / hide shapes in a layout?

Post by gschijndel »

I am also interested in a way to force the "resize back down to original size" of the layout. I have the same issue with tabs, where some tabs use a bigger part of the screen than others (they have an alert row below it). The smaller tabs are enlarged after the bigger tabs have been opened and would like to keep the smaller tabs small instead of pushing the alert row out.

5 posts • Page 1 of 1