rectangle1.top display wrong value

Hello,

I am new to xojo. When using r4.0, I do not seems to encounter this problem. After upgraded to r4.1, this problem seems to arise intermittently.

When opening the web app, the button is set to reposition within the rectangle at run time. Please refer to this screen shot:-
http://prntscr.com/drlg2x

Sometimes, when I start the web app or refresh the web app browser, it does not reposition itself with the rectangle box. Please refer to this screen shot:-
http://prntscr.com/drlhsl

I had placed the codes in the Shown Event Handlers
MsgBox(str(rectangle1.top))
Button1.Top = Rectangle1.Top
Button1.Left = Rectangle1.Left

I also realized that ocassionally, I am getting 0 value for Rectangle1.Top which should not be the case. You may download the sample project from dropbox link:
https://www.dropbox.com/s/q1zds9ifl9wkjt9/test.xojo_binary_project?dl=0

May someone advise why I am getting this inconsistence value (Rectangle1.Top)?

Thank you in advance.

Alvin

Hello,
I think a better solution to make sure that buttons (and other controls) stay inside an rectangular area is to use a container control instead of an rectangle.

An example project with container control…

Hello Christian Mzes,

Thanks for your great effort to send me the example container control project. I think that is what I am looking for. :slight_smile:

Regards,
Alvin