Tip, on how to centered a region. Not so long time ago I thought about this question and wish to share.

Region is staying centered when you pass kFBAttachCenter. That will be a center of a parent’s region. So if you want, for example, a rect 200×200 in the center of another parent rect. You have to specify all like this:

X = -100 (kFBAttachCenter)
Y = -100 (kFBAttachCenter)
Width = 100 (kFBAttachCenter)
Height = 100 (kFBAttachCenter)

If you want to capture only vertical, just keep x and width values by default.

Trick on how to put a region in the center of a layout. Create two regions, first align to the layout region, like 0 (left), 0(top), 0 (width), 0 (height)
and the second region will be -100 (center of region1), -100 (center of region2), 100 (center of region2), 100 (center of region2)

C++ code (exported from UIBuilder tool) – centerRegion2

MotionBuilder UI, centered region
Tagged on:             

Leave a Reply

Your email address will not be published. Required fields are marked *