Resizing Components

In the designer, if I change the size of a container either by dragging the border or typing the new value in the dialog box, the container changes size and its components change size as well with everything remaining in prespective (layout set to relative).

But if I change the size of the container programatically (using fpmi.gui.resizeComponent(…)), then the container changes size but not the contents. If I also add code to loop through the contents and change the componets size at the same time, then I lose the relative positioning. What am I doing wrong?

Hmm, this sounds like an oversight on our part in resizeComponent().

try calling revalidate() on the container after you resize it, like so:

container = ...(something) fpmi.gui.resizeComponent(container, newWidth, newHeight) container.revalidate()

Let me know if that helps…

I gave it a try, and had the same results.

hrm…try container.doLayout() instead of container.revalidate()

No, sorry. Same thing.

Drat, ok, well, I’ll have to investigate it as a bug. Sorry for the inconvenience.

Related to this, I found another anomaly: If I programatically disable a container (but not the components in the container), all of the components get disabled too. No big deal, even though that wasn’t my intention. But, when I enable the container again, all of the components stay disabled. The only way to get them enabled again is via the designer.

Yes, this is by design, its because of how security works. First of all, “enabled” means nothing for a container itself - it only affects the children.

When you set enabled=false, it disables all children. This is so that you can set security settings on a container and have it affect all children. The opposite is not true, however, because otherwise everything would always be enabled, because after all, the container above the container you disabled is probably enabled, and your container is a child of that container… I think you see the problem.

Ok, so I’m looking into this, and I need a few more details:

  1. Are you talking about the designer or the runtime, or both?

  2. If Designer, do you have relative layout turned on in the designer?

  3. Is the container in question a ‘group’?

Step 7,

One technique I sometimes use is to toggle the Visible property of the container instead of the Enabled property. It avoids your original issue as all contained objects retain their original Visible property. This may or may not work for your particular case because you may want the objects to remain visible. You can graphically mimic the containers disabled status with a graphically identical but disabled container whose Visible property is opposite the original container.

I was making it both disabled and invisible, but making it just invisible should suffice. I remember once having a problem with an invisible button that was still enabled which is why I was disabling my container in this case, but I was probably doing something wrong back then.

Carl, I’ll replicate my test and get the exact conditions. Stay tuned…

I was referring to the original issue in this thread, the one that has to do with fpmi.gui.resizeComponent, not the security issue.


Here’s the info you requested:

  1. Are you talking about the designer or the runtime, or both? Both

  2. If Designer, do you have relative layout turned on in the designer? I’ve tried it both ways with the same results.

  3. Is the container in question a ‘group’?[/quote] Yes.