# Bit maths help

### » Fri Nov 25, 2011 11:49 am

Hi,

The problem is.

When I have an Box of
Height=50
Width=50

As It grow's, Then 'text1' one must display an number that not increase(Box.width + Box.Height /4), But instead decrease depending on the box's size.

Does anyone have the brains to help me with this one?
B
7
S
2
G
1
Posts: 193
Reputation: 1,745

### » Fri Nov 25, 2011 12:25 pm

Max number - (Box.Width+Box.Height/4) ?
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

### » Fri Nov 25, 2011 1:30 pm

If you don't have a maximum value, create 2 variables.

1) startvalue = (Box.width + Box.Height /4)
needs to be calculated when the box is created.

2) currentvalue = startvalue - ((Box.width + Box.Height /4) - startvalue)
needs to be calculated whenever the box increases its size. Thi is the value to be shown in the text box.

Example:
at start of layout the box is created with 50, 50

startvalue = 50 + 50 / 4 = 50 + 12.5 = 62.5

the box grows by 10 pixel in width

currentvalue = 62.5 - ((60 + 50 / 4) - 62.5) = 62.5 - (72.5 - 62.5) = 62.5 - 10 = 52.5

box grows again by 10 pixel im height

currentvalue = 62.5 - ((60 + 60 / 4) - 62.5) = 62.5 - (75 - 62.5) = 62.5 - 12.5 = 50

etc.
B
24
S
8
G
10
Posts: 1,821
Reputation: 8,289

### » Fri Nov 25, 2011 2:45 pm

tulamide Thanks alot man, Never would have fuger that out by myself!!
B
7
S
2
G
1
Posts: 193
Reputation: 1,745

### » Sat Nov 26, 2011 1:31 am

fuged?
B
18
S
4
G
1
Posts: 413
Reputation: 2,512

### » Sat Nov 26, 2011 7:48 am

You're welcome :)

[QUOTE=Urled] fuged?[/QUOTE]
No. "to figure out". Like "I never would have figured that out by myself"
B
24
S
8
G
10
Posts: 1,821
Reputation: 8,289