Noticed that setting a Boolean based on a only slightly complex calculation can give the wrong result:
Problem with this code:
Fine if I do this:
Is this a bug or am I missing something?
RBS
Problem with this code:
B4X:
'see if we need vertical buttons
If iMinimumTotalButtonWidth > Parent.Width - 10dip Then
bVerticalButtons = True
Else
'see if we need buttons with different widths
Log("Show, total button width with uniform buttons: " & iTotalButtonWidthWithUniformButtons)
Log("Show, Parent.Width: " & Parent.Width)
If 10dip + iWidestButtonWidth * iButtonsToAdd + (iButtonsToAdd - 1) * 5dip > Parent.Width Then
bNonUniformButtonWidths = True
End If
End If
Fine if I do this:
B4X:
'see if we need vertical buttons
If iMinimumTotalButtonWidth > Parent.Width - 10dip Then
bVerticalButtons = True
Else
'see if we need buttons with different widths
iTotalButtonWidthWithUniformButtons = 10dip + iWidestButtonWidth * iButtonsToAdd + (iButtonsToAdd - 1) * 5dip
Log("Show, total button width with uniform buttons: " & iTotalButtonWidthWithUniformButtons)
Log("Show, Parent.Width: " & Parent.Width)
bNonUniformButtonWidths = iTotalButtonWidthWithUniformButtons > Parent.Width
End If
Is this a bug or am I missing something?
RBS