addimage don't load picture?

tvrman

Member
Licensed User
hello below doesn't load the picture ??

A1.Add(AppPath & "\" & r)
AddImage("Panel1",image ,0,row, 120, 120)
Control(image).image= A1.Item(0)

it works like below

Control(image).image= "image1.jpg"

also tried which also not works

picture = Apppath & "\" & "image.jpg"

Control(image).image= picture


did i miss something?

cheers
 

tvrman

Member
Licensed User
Yes, the quotes around the control name!

Control("image1").image= "image.jpg"
This has been done because image = variable it contains the picture
object like image1 image2 ....

i'm having problems with the picture name image.jpg which seems cannot
be put in a variable.

cheers
 

specci48

Well-Known Member
Licensed User
Hi tvrman,

I tried the following small code and it works:
B4X:
Sub Globals
End Sub

Sub App_Start
r = "Img1.gif"
A1.Add(AppPath & "\" & r)
r = "Img2.gif"
A1.Add(AppPath & "\" & r)
r = "Img3.gif"
A1.Add(AppPath & "\" & r)
For i = 0 To A1.Count - 1
   image = A1.Item(i)
   row = i * 100
   AddImage("Form1", image, 0, row, 50, 50)
   Control(image).image= A1.Item(i)
Next
   Form1.Show
End Sub
What have you done different to this code?


specci48
 

agraham

Expert
Licensed User
Sorry, I misunderstood the problem. However the following works fine on my system. Form1 is totally blank to begin with.
B4X:
Sub App_Start
   Form1.Show
             image="image1" ' missed this line originally
   AddPanel("Form1","Panel1",0,0,100,100)
   r = "image.jpg"
   AddArrayList("A1")
   A1.Add(AppPath & "\" & r)
   AddImage("Panel1",image ,0,row, 120, 120)
   Control(image).image= A1.Item(0)
End Sub

EDIT: Opps - missed a line out. Intriguingly it worked without the variable "image" being assigned anything!
 
Last edited:

tvrman

Member
Licensed User
Hi guys

it works!!!

c = StrIndexOf (r ,".jpg",0)
If c = -1 Then
AddLabel("Panel1", "'" & Label & "'" ,0,row, 800, 15, r)
Else
AddArrayList("A1")
A1.Add(AppPath & "\" & r)
AddImage("Panel1",image ,0,row, 420, 120)
Control(image).image = A1.Item(0)
row = row + 45

End If


I have made an terrible mistake, i read an file and compaire each row
i the row contains .jpg then put an image on the panel and show it
because the image was one wich i have taken in 3 mega pix (high res) and the size of it, i saw only one part of the picture and that one was one of the
left upper corner wich was only black (grey) i though it didn't load the picture at all, stupid me..

:sign0013::sign0148:
 
Top