Reading the width of a control

In a view’s Activate event, when I access a control’s Width I always get 100. Have the constraints not kicked in yet?

Well i seem to have this issue too with 2018R4… Anyone have an update how to get the TRUE width of a control ?

Not here:

Sub Open() Handles Open L_Info.Text = "cLinux.Width: " + Str(cLinux.Width) End Sub

Returns 128, 128 is the correct result in that case.

[quote=427356:@Emile Schwarz]Not here:

Sub Open() Handles Open L_Info.Text = "cLinux.Width: " + Str(cLinux.Width) End Sub

Returns 128, 128 is the correct result in that case.[/quote]

Is it iOS where you get this?

I just saw the channel name. Sorry, I get that on Desktop (El Capitan).

“I’m so tired…“

Using iOSDesignExtensions you can use the GetBoundsXC function to get the real width of a control.

Usually in the Activate event the layout is already settled and you shouldn’t get 100 each time.
In Open event, forget about getting the width.

However on some complex layouts, you might be better calling a timer with 10ms delay :

  1. Add a function to your view

Public Sub DelayedLayout() //Do something with control width End Sub

  1. In View.activate event:
xojo.core.timer.calllater(10, AddressOf DelayedLayout)

I use that very often in iOS apps