Trying to learn Basic4PPC, i used BouncingSmiley program as a template to explore the ADDOBJECT function. I added logic to add more smileys when it hit the edges. I randomly obtain the new speed and size of the smiley. Everything works well on desktop. When I tried to COMPILE DEVICE EXE, I got compile error:
Error compiling program
Error message: Unknown control type. Use Control(Name, Type) instead.
Line number: 39
Line:Control(strB).New1 (appPath & imageFile)
Here the subroutine:
Sub DrawSmileyImage
strB = "objBitmap" & iIndex
strEB = "objEraseBrush" & iIndex
strRS = "objRectSource" & iIndex
strRD = "objRectDest" & iIndex
strD = "objDrawer" & iIndex
speed(iIndex).X = Rnd(1, 5) : Speed(iIndex).Y = speed(iIndex).X
smileySize = Rnd(10,30)
AddObject (strB, "Bitmap")
'Control(strB).New1 (AppPath & "\smiley.gif")
'Control(strB).New1 (AppPath & imagelist1.Item(0))
GetImageFile
Control(strB).New1 (AppPath & imageFile)
transparentColor = Control(strB).GetPixel1(0,0)
SetTransparentColor(transparentColor)
Form1.ForeLayer = True
AddObject (strEB, "Brush")
Control(strEB).New1(transparentColor)
AddObject (strD, "Drawer")
Control(strD).New1("Form1", True)
AddObject (strRS, "Rectangle")
Control(strRS).New1(0,0,Control(strB).Width, Control(strB).Height)
AddObject (strRD, "Rectangle")
T = Rnd(10,120) : L = T
Control(strRD).New1(T, L, smileySize, smileySize)
Control(strD).DrawImage1(Control(strB).Value, Control(strRS).Value, _
Control(strRD).Value, True)
End Sub
Error compiling program
Error message: Unknown control type. Use Control(Name, Type) instead.
Line number: 39
Line:Control(strB).New1 (appPath & imageFile)
Here the subroutine:
Sub DrawSmileyImage
strB = "objBitmap" & iIndex
strEB = "objEraseBrush" & iIndex
strRS = "objRectSource" & iIndex
strRD = "objRectDest" & iIndex
strD = "objDrawer" & iIndex
speed(iIndex).X = Rnd(1, 5) : Speed(iIndex).Y = speed(iIndex).X
smileySize = Rnd(10,30)
AddObject (strB, "Bitmap")
'Control(strB).New1 (AppPath & "\smiley.gif")
'Control(strB).New1 (AppPath & imagelist1.Item(0))
GetImageFile
Control(strB).New1 (AppPath & imageFile)
transparentColor = Control(strB).GetPixel1(0,0)
SetTransparentColor(transparentColor)
Form1.ForeLayer = True
AddObject (strEB, "Brush")
Control(strEB).New1(transparentColor)
AddObject (strD, "Drawer")
Control(strD).New1("Form1", True)
AddObject (strRS, "Rectangle")
Control(strRS).New1(0,0,Control(strB).Width, Control(strB).Height)
AddObject (strRD, "Rectangle")
T = Rnd(10,120) : L = T
Control(strRD).New1(T, L, smileySize, smileySize)
Control(strD).DrawImage1(Control(strB).Value, Control(strRS).Value, _
Control(strRD).Value, True)
End Sub