R RichardK Member Licensed User Longtime User May 12, 2012 #1 Newbie Question - I am trying to display a graphic: why does this not work? (The imgCard place-holder remains blank). Many thanks in advance Sub Globals Dim imgCard As ImageView Dim btnStart As Button End Sub Sub Activity_Create(FirstTime As Boolean) 'Comment: Main includes an ImageView named imgCard and btnStart Activity.LoadLayout("Main") End Sub Sub btnStart_click 'Comment: file "c01.jpg added to the project via "Add Files" imgCard.Initialize("") imgCard.bitmap = LoadBitmap(File.DirAssets, "c01.jpg") End Sub
Newbie Question - I am trying to display a graphic: why does this not work? (The imgCard place-holder remains blank). Many thanks in advance Sub Globals Dim imgCard As ImageView Dim btnStart As Button End Sub Sub Activity_Create(FirstTime As Boolean) 'Comment: Main includes an ImageView named imgCard and btnStart Activity.LoadLayout("Main") End Sub Sub btnStart_click 'Comment: file "c01.jpg added to the project via "Add Files" imgCard.Initialize("") imgCard.bitmap = LoadBitmap(File.DirAssets, "c01.jpg") End Sub
klaus Expert Licensed User Longtime User May 12, 2012 #2 I suppose that imgCard is defined in the layout file. If yes, you must remove this line: Code: Copy imgCard.Initialize("") Best regards. Upvote 0
I suppose that imgCard is defined in the layout file. If yes, you must remove this line: Code: Copy imgCard.Initialize("") Best regards.
R RichardK Member Licensed User Longtime User May 12, 2012 #3 Still a problem Thanks Klaus, Line removed - however i now get the message in the emulator "Program paused on line 15 (followed by the "imgCard. . ." line of code. The code itself has turned yellow. Any further thoughts will be gratefully received. RichardK Upvote 0
Still a problem Thanks Klaus, Line removed - however i now get the message in the emulator "Program paused on line 15 (followed by the "imgCard. . ." line of code. The code itself has turned yellow. Any further thoughts will be gratefully received. RichardK
Woinowski Active Member Licensed User Longtime User May 12, 2012 #4 Stack trace and complete project woul help Can you provide the stack trace and your project (export as zip)? Upvote 0
Stack trace and complete project woul help Can you provide the stack trace and your project (export as zip)?
R RichardK Member Licensed User Longtime User May 12, 2012 #5 Cards.zip attached Thanks for your interest - here it is, Richard Attachments Cards.zip Cards.zip 10.4 KB · Views: 312 Upvote 0
klaus Expert Licensed User Longtime User May 12, 2012 #6 Here you are. As the ImgCard has been defined in the layout file you must Dim it in Globals and not initialize it. Best regards. Attachments Cards1.zip Cards1.zip 10.4 KB · Views: 328 Upvote 0
Here you are. As the ImgCard has been defined in the layout file you must Dim it in Globals and not initialize it. Best regards.
R RichardK Member Licensed User Longtime User May 12, 2012 #7 Thank you very much I am amazed - I was sure that that was one of the combinations I had tried. Apparently not. Thanks again - I was on the point of total insanity. Richard Upvote 0
Thank you very much I am amazed - I was sure that that was one of the combinations I had tried. Apparently not. Thanks again - I was on the point of total insanity. Richard