I'm trying to set up the vertical spacing of my screen Labels using nn%y method. It works fine when I'm hard coding in the values but now I need to set them using variables.
I've declared a global var to hold the value but I am unsure of what data type it should be. I'm currently declaring it as a Float:
However, when I get around to assigning it to the Label .Top property, in the debugger it shows the value as 9 vs what it should be 9%y.
If I declare the var as a string then when I assign it to the .Top property I get a data type mismatch compiler error.
Should I declare the global var as a String and then just cast it to a Float when assigning it to the .Top property since it is expecting that data type?
Var pmain_lbl_TitleTop is a Float.
I'm setting the label .Top property like this:
My other option would be to pass the "3%y" as an argument in my CallSub but I get compiler messages when I tried that so I guess I don't have the right syntax plus I still have the same problem: passing a string that will be assigned to a Float (.Top property).
So I don't which is better, go with the global var or pass the parameter in the CallSub?
Thanks...
I've declared a global var to hold the value but I am unsure of what data type it should be. I'm currently declaring it as a Float:
B4X:
Dim pTop_Position As Float : pTop_Position = 5%y
However, when I get around to assigning it to the Label .Top property, in the debugger it shows the value as 9 vs what it should be 9%y.
If I declare the var as a string then when I assign it to the .Top property I get a data type mismatch compiler error.
Should I declare the global var as a String and then just cast it to a Float when assigning it to the .Top property since it is expecting that data type?
Var pmain_lbl_TitleTop is a Float.
I'm setting the label .Top property like this:
B4X:
lbl_main_Title.Top = pmain_lbl_TitleTop * pScreenHeight
My other option would be to pass the "3%y" as an argument in my CallSub but I get compiler messages when I tried that so I guess I don't have the right syntax plus I still have the same problem: passing a string that will be assigned to a Float (.Top property).
B4X:
CallSub(Main, "Set_Landscape_Parameters("3%y")")
B4X:
Sub Set_Landscape_Parameters(mTop as String)
So I don't which is better, go with the global var or pass the parameter in the CallSub?
Thanks...
Last edited: