Realbasic.Rect

What am I missing here?

myRect.VerticalCenter = 10

Dim d As double = myRect.VerticalCenter

The debugger shows d = 5.5 and that seems to be where it is on the Canvas. I would have assumed it moved to 10 from the first line of code.

I get 5.0, not 5.5. In fact the value stored seems to always be half what was assigned. Appears a bug, workaround is multiple by 2 whenever assigning VerticalCenter. Unless you are getting 5.5?

Yeah it says the VC is at 5.5 for 10, 9.5 for 20 & 10.5 for 21. I thought maybe that’s because the Rect has a Height of 13 so I changed it to 14 and still the same thing, so:
A) doesn’t make sense it’s at a .5 of a pixel
B) isn’t consistent with the +/- .5 of a pixel

Thanks though

Reading the vertical center works as expected. For example, a rect of 10,10,10,10 returns a vertical center of 15. That is correct. However, assigning a value to vertical center doesn’t make any sense. I can’t make heads or tails of what it is doing. Assigning the same value of 15 to the vertical center of the same rect gives back 10,2,10,10. So in this case, it moves up by 7 pixels. No half pixels values came up in my tests.

On a PC using Windows 8.1,

I would never have never used a double, except I noticed in the debugger when my rectangle was in the wrong place it said the VC was at 5.5

Perhaps for the time being you can set the top as opposed to the center? Then file a feedback case?

The VerticalCenter Setter and Getter are dependent on the Height being set first.

Of course. That doesn’t change anything we’ve said previously.

Excuse me. I figured that looking at the code and giving everyone a definite answer was better than guesses.