The current Rect class has the properties:
Bottom, CenterX, CenterY, Left, Right, Top
I'd like to see Width and Height properties added so if you set Width, it will automatically adjust the Right property wrt Left property. If you read the Width it will return Right-Left. Similar for Height. So it does not have to store Width or Height, but when writing to Width/Height it will adjust the current Right/Bottom properties. When it reads from Width/Height it will just calculate the value from Right-Left or Bottom-Top.
Example:
This makes it easier to use Rect to store view positions (which use Width & Height).
Bottom, CenterX, CenterY, Left, Right, Top
I'd like to see Width and Height properties added so if you set Width, it will automatically adjust the Right property wrt Left property. If you read the Width it will return Right-Left. Similar for Height. So it does not have to store Width or Height, but when writing to Width/Height it will adjust the current Right/Bottom properties. When it reads from Width/Height it will just calculate the value from Right-Left or Bottom-Top.
Example:
B4X:
Rect1.Left = 100dip
Rect1.Width = 200dip
Rect1.Top = 10dip
Rect1.Height = 100dip
This makes it easier to use Rect to store view positions (which use Width & Height).
Attachments
Last edited: