B4J Question Designer Scripts and Anchors (I feel dumb, but....)

Cableguy

Expert
Licensed User
Longtime User
Hi guys,

I am most certainly doing something wrong, but here it is...
I have 2 panels, one is the child of the other, the parent is positioned by a designer script, and the child panel is Anchored at 3dpi from each side (anchor = both, for both vertical and horizontal)
I'm my head, this would render my child panel with the correct position relative to the parent, after the designer script is applied... however, it seems to be the other way around... first the anchors are applied and then the script is executed, which render the image below (the red square is the position of the child panel before the script is applied):
1752783853636.png



So.... must I set every single view I'll be adding to this parent panel with designer scripts, or am I missing something obvious?
 

PaulMeuris

Well-Known Member
Licensed User
The screenshot you show is the read-only mode of the script. Click on the properties panel and you should see the real layout.
Pane1 should cover almost the complete ConfigPanel like this:
1752812132851.png

When you run the application you get this result:
1752812292219.png

The designer script adjusts the size of the ConfigPanel (30% of the variant width and 70% of the variant height).
The width and height of Pane1 is not adjusted to the width and height of the ConfigPanel.
So the anchors don't seem to work.
If you adjust the width and height of Pane1 to within the width and height of the ConfigPanel after the designer script runs you will get the whole Pane1 inside the ConfigPanel. But then you better not use anchors for the Pane1.
1752812767614.png
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Hi @PaulMeuris ,

Indeed that's the way it behaves, but not the way I expected it to behave.
I posted the screenshot in ready only mode because that's the default behavior once you hit play( execute the script), If this action is not performed, the script is "ignored" even by the WYSIWYG layout visual aid.

It will be easy to create a sub-layout that will be loaded to the child panel and that by using Anchor only, will behave as I want it to... I was just trying to understand if this is a "must be done this way" kind of thing, or that I missed something, like some IDE keyword that would allow me to first run the script, and then apply the Anchors. This way I could create a single complex layout instead of having to create multiple simpler layouts and loading them... it's just a few steps more, I know, but extra steps nonetheless.
 
Upvote 0
Top