how to add dip with variables

Aysic4Bandroid

Member
Licensed User
Longtime User
hi all,

This may be an embarrassingly simple thing but im puzzled as to how i go about using the dip measurement with a variable name so when i have an integer variable such as:

B4X:
dim leftedge as int
leftedge=112

spnOpenfile.left = leftedge dip

Doing so highlights 'dip' as an error it works leaving it off but is there a way to explicitly add 'dip' to an int variable name?? :BangHead:
 

Aysic4Bandroid

Member
Licensed User
Longtime User
ok,
should have tried it first, i did it but didnt run it cos it kind of looks so wrong like concatenating an int to a string

thanks for that, NJDude
 
Upvote 0

Mike Henry

Member
Licensed User
Longtime User
I don't know if anyone is still reading this old thread, but I'd like to add a comment.
It appears DIP returns an integer, so if DIP is 0.9 then 1DIP will return 0.
The only way I got DIP to work with a variable is to convert it to a double before hand.
Like this:
B4X:
   Dim dipf As Double
   dipf = 100dip / 100
   V.Left = ReScale(N) * dipf
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…