Using variable names with dips

Trigger

Member
Licensed User
Longtime User
Hi all,

A really simple question which must have been answered somewhere on the forums, but I can't see it:

How do I use a variable name with dips? For example, I have a button whose location depends upon the activity dimensions. It is calculated based on the size of other views in the activity, so i have:

B4X:
    For i = 0 To 3
      cmdTest(i).Top = Activity.Height-100dip
     ButtonLocation = ((100+ButtonSpacing)*(1+i))
     cmdTest(i).Left = ButtonLocation
      cmdTest(i).Text = "TEST " & (i+1)
      cmdTest(i).Width = 100dip
      cmdTest(i).Height = 100dip
     If i = TestNo-1 Then
        cmdTest(i).TextColor = Colors.Green
     Else
        cmdTest(i).TextColor = Colors.Black
     End If
    Next

ButtonLocation is an integer, but I want to specify cmdTest(i).Left in dips, so how do i do it? I can't have ButtonLocationdip or (ButtonLocation)dip.

Is that right, or have I misunderstood something? :sign0104:

Thanks,

Dave
 
Top