Get Body Part Height

How do we get the height of the body part?

I'd like to be able to use the height of the body to determine the window size. At present, I'm using an onLayoutEnter script trigger to pass the values. This is hard coded. The body size could change so I'm wondering about a dynamic way to get this information.

I can envisage a layout table that records the different layout parts and their attributes but I don't want to put that much effort into this project.

Should I make this a feature request?

1 Like

Hi Malcolm,

Is this about needing to make an adjustment because the user may manually resize the window, and then you'd like to be able to programmatically determine the body height?

Or is this more about needing to know the body height of an arbitrary layout, so that any scripting that navigates to that layout can know the body dimensions in order to be able to size the window accordingly?

A thought:

Something which I think would be less effort than maintaining a table with layout part dimensions might be maintaining a standardly-named layout object on every layout where this matters. The content of the layout object could be some text (JSON, even) which records the important dimensions. Then, any script that cares about this could use GetLayoutObjectAttribute to query the current layout for its part dimensions via this specially added object. IIRC, even a hidden layout object can still be queried for its content using GetLayoutObjectAttribute. It still requires maintenance overhead, of course, but I think I'd prefer this to maintaining a table.

I do something similar when I want to do conditional branching for certain layouts, but I don't want to hardcode layout names or IDs into my scripting. I'll use a hidden layout object as a flag/marker to indicate if/whether/how the layout is to be handled.


Seems like a good request, IMO.

I like your thinking. That's easy to implement and easy to maintain.

This is for managing layouts that will open in card windows displaying in list view. The current gotcha is that the window auto-sizes to display exactly one body part. This confuses me - and I'm the developer. I want my list to be a list. I'm defaulting to five records in view at a time. With that in mind, I modify the layout to add four and a half body heights to the window height. The extra half a body height is added because I want to suggest to the user that there is more in the list.

1 Like

My suggestion is close to that of @steve_ssh. Add a standardly-named rectangle objects to any part of importance. Size each rectangle to the size of its layout part. Ensure all object anchors are active. Make the rectangles invisible if need be. Use GetLayoutObjectAttribute to query the rectangle size. This should give you the rectangle size and take into account window resizing.


I've been trying out both suggestions. @steve_ssh your method works consistently. @bdbd your method works inconsistently. It fails on most runs, though it performs perfectly when testing in the debugger.

After experimenting with this I have decided not to use list view in card windows. I will use portals instead.

The scroll bars on list views look awful. Really awful.

1 Like