LucaMs Expert Licensed User Longtime User Sep 30, 2014 #1 In a class I have this property: B4X: Public Sub setTypeFace1(TypeFace1 As Typeface) mTypeFace1 = TypeFace1 End Sub but when I use: MyInstance.TypeFace1 = Typeface.DEFAULT I get an error at compile time (oddly enough, not when I use ALT + 2)
In a class I have this property: B4X: Public Sub setTypeFace1(TypeFace1 As Typeface) mTypeFace1 = TypeFace1 End Sub but when I use: MyInstance.TypeFace1 = Typeface.DEFAULT I get an error at compile time (oddly enough, not when I use ALT + 2)
klaus Expert Licensed User Longtime User Sep 30, 2014 #2 LucaMs said: MyInstance.TypeFace1 = Typeface.DEFAULT Click to expand... What is MyInstance ? Maybe this would work : MyInstance.TypeFace = Typeface.DEFAULT Upvote 0
LucaMs said: MyInstance.TypeFace1 = Typeface.DEFAULT Click to expand... What is MyInstance ? Maybe this would work : MyInstance.TypeFace = Typeface.DEFAULT
LucaMs Expert Licensed User Longtime User Sep 30, 2014 #3 klaus said: What is MyInstance ? Maybe this would work : MyInstance.TypeFace = Typeface.DEFAULT Click to expand... It is an object of MyClass type (I have used pseudo-code) Upvote 0
klaus said: What is MyInstance ? Maybe this would work : MyInstance.TypeFace = Typeface.DEFAULT Click to expand... It is an object of MyClass type (I have used pseudo-code)
LucaMs Expert Licensed User Longtime User Sep 30, 2014 #4 klaus said: What is MyInstance ? Maybe this would work : MyInstance.TypeFace = Typeface.DEFAULT Click to expand... Attachments Typeface Property.zip 12.3 KB · Views: 262 Upvote 0
klaus said: What is MyInstance ? Maybe this would work : MyInstance.TypeFace = Typeface.DEFAULT Click to expand...
klaus Expert Licensed User Longtime User Oct 1, 2014 #5 In the calling routine this works: Dim tf = Typeface.DEFAULT As Typeface mClass.Typeface1 = tf Upvote 0
LucaMs Expert Licensed User Longtime User Oct 1, 2014 #6 klaus said: In the calling routine this works: Dim tf = Typeface.DEFAULT As Typeface mClass.Typeface1 = tf Click to expand... Thank you for your interest, Klaus. I have not figured out where that code works for you; in the project that I have attached the class is called MyClass. The error message gives me the impression that Typeface is a Constant and not a Type. Upvote 0
klaus said: In the calling routine this works: Dim tf = Typeface.DEFAULT As Typeface mClass.Typeface1 = tf Click to expand... Thank you for your interest, Klaus. I have not figured out where that code works for you; in the project that I have attached the class is called MyClass. The error message gives me the impression that Typeface is a Constant and not a Type.
Erel B4X founder Staff member Licensed User Longtime User Oct 1, 2014 #7 Klaus code should work. The problem arises because Typeface.DEFAULT mistakenly returns the native object instead of the wrapper. Upvote 0
Klaus code should work. The problem arises because Typeface.DEFAULT mistakenly returns the native object instead of the wrapper.
klaus Expert Licensed User Longtime User Oct 1, 2014 #8 It works, I tested it. Attachments Typeface Property_1.zip 12.3 KB · Views: 272 Upvote 0
LucaMs Expert Licensed User Longtime User Oct 1, 2014 #9 klaus said: It works, I tested it. Click to expand... Yes, I did not understand what you mean, that is where it functioned. But it does not matter where, the point is that it works. It will mean that the programmer will have to use that method. Thank you, Klaus Upvote 0
klaus said: It works, I tested it. Click to expand... Yes, I did not understand what you mean, that is where it functioned. But it does not matter where, the point is that it works. It will mean that the programmer will have to use that method. Thank you, Klaus
klaus Expert Licensed User Longtime User Oct 1, 2014 #10 If you download the small test project you'll see the proof ! Upvote 0
LucaMs Expert Licensed User Longtime User Oct 1, 2014 #11 klaus said: If you download the small test project you'll see the proof ! Click to expand... Done, before my previous post Upvote 0
klaus said: If you download the small test project you'll see the proof ! Click to expand... Done, before my previous post