View Single Post
  #1  
Unread 02-26-2008, 02:47 PM
Drumstix42's Avatar
Drumstix42 Drumstix42 is offline
A Griffon
Featured
 
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
Default How to convert decimals to integers

I wanted to follow up with a slight work-around for the problem I explained above:

Quote:
Originally Posted by Drumstix42 View Post
With the new "Top" "Height" "Left" and "Width" values, I've been messing around with some trigger events to try to change the size of other objects.
The problem is if I try to do any math, I'll get the 3 trailing decimals, ie 147.000
I tried manually putting in 147.000 into the "Height" property, and it wouldn't accept it. It just kept the previous value in there.

I guess my request is that these fields be updated to accept decimal inputs, and just trim off the trailing decimals.

*edit* My work around was to just set a nonvisable object the same size as the original, with the same pack size/location properties. (I'm changeing the size of a frame depending on certain conditions). This way I could change the size back and forth, without doing the simple math equations.
I've used my solution in my Info Center, because I needed to use simple math to properly display my drop-down list in the tree-view. I have to add several values together to position them correctly when each expands/collapses. I also had to change the scroll length each time.

While the "Top" "Height" "Left" and "Width" do not support trailing decimals, the comma delimited (IE: Location, MinimumScrollExtent) values will. It will trim off the decimals automatically. I forget where I first saw this mentioned, but I tried it for myself in the UIBuilder a while ago.

Code:
Parent.Parent.Parent.Parent.Select.MinimumScrollExtent=('146' ## ',' ## SUM) SUM=(Parent.Parent.SETTINGS.SizeCollection) + (Parent.Parent.SETTINGS.SizeTotal)
Parent.Parent.HQ.Location=('0' ## ',' ## ADD) ADD=(Parent.Parent.Collection.Top) + (Parent.Parent.Collection.Height)
Hope this helps.
__________________
"I'm afraid you're guilty of thought-crime. Don't bother getting the door, we'll let ourselves in..."
<Donate to DrumsUI> < [DrumsUI] Updater > < [DrumsUI] Full Interface> < Drumstix42 on Twitch.tv
>
Reply With Quote