S scrat Active Member Licensed User Longtime User Oct 18, 2013 #1 Hi! I am using this code in a class Code: Copy Dim Bmp As Bitmap Bmp.InitializeMutable(Wbmp,Hbmp) Dim C As Canvas C.Initialize2(Bmp) C.DrawText(Str,x,y,Typeface.SANS_SERIF,25dip,Colors.Blue,"CENTER") and i get this error Error compiling program. Error description: An Activity context is required. This class has a process context. Adding a global "Activity object" variable will fix this issue. Occurred on line: 154 C.DrawText(Str,x,y,Typeface.SANS_SERIF,25dip,Colors.Blue,"CENTER") Word: drawtext Click to expand... I know I can use a DummyView but the bitmap is stored in a processglobal map. Why drawtext use an activity context ? Thanks
Hi! I am using this code in a class Code: Copy Dim Bmp As Bitmap Bmp.InitializeMutable(Wbmp,Hbmp) Dim C As Canvas C.Initialize2(Bmp) C.DrawText(Str,x,y,Typeface.SANS_SERIF,25dip,Colors.Blue,"CENTER") and i get this error Error compiling program. Error description: An Activity context is required. This class has a process context. Adding a global "Activity object" variable will fix this issue. Occurred on line: 154 C.DrawText(Str,x,y,Typeface.SANS_SERIF,25dip,Colors.Blue,"CENTER") Word: drawtext Click to expand... I know I can use a DummyView but the bitmap is stored in a processglobal map. Why drawtext use an activity context ? Thanks
Erel B4X founder Staff member Licensed User Longtime User Oct 20, 2013 #2 Canvas itself is an "activity object". You can declare the canvas object in Class_Globals. It will work, assuming that you don't need a process global instance of this class. Upvote 0
Canvas itself is an "activity object". You can declare the canvas object in Class_Globals. It will work, assuming that you don't need a process global instance of this class.
S scrat Active Member Licensed User Longtime User Oct 21, 2013 #3 Thanks Erel. Unfortunately the class has a process global instance. I use drawtext from ABextdraw and i don't have this behavior. Other B4a drawing functions (drawcircle,drawline etc..) operate without this error. Upvote 0
Thanks Erel. Unfortunately the class has a process global instance. I use drawtext from ABextdraw and i don't have this behavior. Other B4a drawing functions (drawcircle,drawline etc..) operate without this error.