ArminKH Well-Known Member Mar 1, 2015 #1 hi i want to get typeface and textsize of an object(a label or button) by reflection here is my code Code: Copy Sub TextSize(Target As Object) Dim GetTextSize As Reflector GetTextSize.Target=Target Log(GetTextSize.RunMethod("getTextSize")) End Sub but above code return wrong value for example when my textsize in label is 16 this sub return 24 and if is possible please help me to find the method of GetTypeface by reflection tnx
hi i want to get typeface and textsize of an object(a label or button) by reflection here is my code Code: Copy Sub TextSize(Target As Object) Dim GetTextSize As Reflector GetTextSize.Target=Target Log(GetTextSize.RunMethod("getTextSize")) End Sub but above code return wrong value for example when my textsize in label is 16 this sub return 24 and if is possible please help me to find the method of GetTypeface by reflection tnx
Erel B4X founder Staff member Licensed User Longtime User Mar 1, 2015 #2 If you are developing with B4A then you should use B4A api. There is no reason to use reflection here. Code: Copy Sub TextSize(Target As Object) As Double Dim lbl As Label = Target Return lbl.TextSize End Sub Sub Typeface(Target As Object) As Typeface Dim lbl As Label = Target Return lbl.Typeface End Sub Upvote 0
If you are developing with B4A then you should use B4A api. There is no reason to use reflection here. Code: Copy Sub TextSize(Target As Object) As Double Dim lbl As Label = Target Return lbl.TextSize End Sub Sub Typeface(Target As Object) As Typeface Dim lbl As Label = Target Return lbl.Typeface End Sub
ArminKH Well-Known Member Mar 1, 2015 #3 Erel said: If you are developing with B4A then you should use B4A api. There is no reason to use reflection here. Code: Copy Sub TextSize(Target As Object) As Double Dim lbl As Label = Target Return lbl.TextSize End Sub Sub Typeface(Target As Object) As Typeface Dim lbl As Label = Target Return lbl.Typeface End Sub Click to expand... i do your said way but for example when target is a button after use above subs my button converted to label and thats not is a button Upvote 0
Erel said: If you are developing with B4A then you should use B4A api. There is no reason to use reflection here. Code: Copy Sub TextSize(Target As Object) As Double Dim lbl As Label = Target Return lbl.TextSize End Sub Sub Typeface(Target As Object) As Typeface Dim lbl As Label = Target Return lbl.Typeface End Sub Click to expand... i do your said way but for example when target is a button after use above subs my button converted to label and thats not is a button
klaus Expert Licensed User Longtime User Mar 1, 2015 #4 What exactly do you want to do ? I saw quite some threads and posts about almost the same problem. So, please explain what is your foundamental problem or concern ! I have the feeling that we are turning in circle. You ask questions for 'detailed problems', but you don't explain your REAL expectations or needs. I had never the need for any of your requests which couldn't be solved with STANDARD B4A properties or methods. Upvote 0
What exactly do you want to do ? I saw quite some threads and posts about almost the same problem. So, please explain what is your foundamental problem or concern ! I have the feeling that we are turning in circle. You ask questions for 'detailed problems', but you don't explain your REAL expectations or needs. I had never the need for any of your requests which couldn't be solved with STANDARD B4A properties or methods.
Erel B4X founder Staff member Licensed User Longtime User Mar 2, 2015 #5 I agree with Klaus. arminkh said: target is a button after use above subs my button converted to label and thats not is a button Click to expand... That is not correct. It will not convert a button to a label. Upvote 0
I agree with Klaus. arminkh said: target is a button after use above subs my button converted to label and thats not is a button Click to expand... That is not correct. It will not convert a button to a label.
ArminKH Well-Known Member Mar 2, 2015 #6 Erel said: I agree with Klaus. That is not correct. It will not convert a button to a label. Click to expand... Yes you right I initilize button by canvas Canvas1.initialize(lbl) And my btn changed to label After using canvas1.initialize(activity) Now its working Last edited: Mar 2, 2015 Upvote 0
Erel said: I agree with Klaus. That is not correct. It will not convert a button to a label. Click to expand... Yes you right I initilize button by canvas Canvas1.initialize(lbl) And my btn changed to label After using canvas1.initialize(activity) Now its working