Layouts management

Discussion about recent product features & solutions!
3 posts • Page 1 of 1
AdrianSan
Posts:13
Joined: Thu Aug 27, 2020 5:17 pm

Layouts management

Post by AdrianSan »

Hi there,

I have been working on a panel with several embedded modules, that load panels with several shapes. These shapes are buttons, texts, etc, and they are hidden if the connected signals has no _address configured. My question is:

1) When I load the panel I can see all the shapes re-arranging themselves and I would like to see the final result directly, even if it takes 1 seconds or something more. I have taken a look at the Performance Implementation tips and I thought that "synchronized" could do the job but maybe I did not use it well. This panel is not instantiated only once, so I don't know if cacheing it would work,

2) These shapes are programmed to summon a little picture at the top right of them (like an exponent), so I get the position and size of the shape to do it. The problem is that, if done at init, the position is calculated after the Layout is re-arranged so this little picture is placed somewhere below (where the shape is in gedi originally). However, if this picture is added after init, it works fine.

Could you give me some hints about this? Thank you in advance.

adaneau
Posts:310
Joined: Tue Feb 21, 2012 9:49 am

Re: Layouts management

Post by adaneau »

Hi,

For 1)
You can use self.updatesEnabled(FALSE); at very first. This will make any operation not visible until you put again self.updatesEnabled(TRUE); You can also put your layout invisible by the time of building it. Lot of solutions are possible.

For 2)
Maybe your exponent should be layouted as well? In my opinion (and from my experience) mixing layouting and strict positioning can lead to disasters.

BR
Alex

AdrianSan
Posts:13
Joined: Thu Aug 27, 2020 5:17 pm

Re: Layouts management

Post by AdrianSan »

Hi,

I did as you explained, and it worked better, thank you!
I tried the self.updatesEnabled but I don't see where my code ends to set up the True again. So since the troublesome panel is only one, I set the layout to not visible as you said (during 600ms in a separated thread).

And as for the exponent the same, I could not come up with a good solution to mix layouting and positioning so I ended up including it in the layout.

Sorry for the late response and thank you!

3 posts • Page 1 of 1