Click function

neilnapier

Active Member
Licensed User
Longtime User
Well... I'm making my first program on the ppc and I was using the function Click on image boxes to change the colour of them. On the computer it works perfectly but then on the ppc the image boxes don't show up at all, so I can't click on them. This is my code...

B4X:
Sub Globals

End Sub

Sub App_Start
   Form1.Show
End Sub

Sub Image2_Click
Image2.color = 255,0,0
End Sub
Sub Image3_Click
Image3.color = 255,0,0
End Sub
Sub Image4_Click
Image4.color = 255,0,0
End Sub
Sub Image5_Click
Image5.color = 255,0,0
End Sub
Sub Image6_Click
Image6.color = 255,0,0
End Sub
Sub Image7_Click
Image7.color = 255,0,0
End Sub
Sub Image8_Click
Image8.color = 255,0,0
End Sub
Sub Image9_Click
Image9.color = 255,0,0
End Sub
Sub Image10_Click
Image10.color = 255,0,0
End Sub
Sub Image11_Click
Image11.color = 255,0,0
End Sub
Sub Image12_Click
Image12.color = 255,0,0
End Sub
Sub Image13_Click
Image13.color = 255,0,0
End Sub
Sub Image14_Click
Image14.color = 255,0,0
End Sub
Sub Image15_Click
Image15.color = 255,0,0
End Sub
Sub Image16_Click
Image16.color = 255,0,0
End Sub
Sub Image17_Click
Image17.color = 255,0,0
End Sub
Sub Image18_Click
Image18.color = 255,0,0
End Sub
Sub Image19_Click
Image19.color = 255,0,0
End Sub
Sub Image20_Click
Image20.color = 255,0,0
End Sub
Sub Image21_Click
Image21.color = 255,0,0
End Sub
Sub Image22_Click
Image22.color = 255,0,0
End Sub
Sub Image23_Click
Image23.color = 255,0,0
End Sub
Sub Image24_Click
Image24.color = 255,0,0
End Sub
Sub Image25_Click
Image25.color = 255,0,0
End Sub
Sub Image26_Click
Image26.color = 255,0,0
End Sub
Sub Image27_Click
Image27.color = 255,0,0
End Sub
Sub Image28_Click
Image28.color = 255,0,0
End Sub
Sub Image29_Click
Image29.color = 255,0,0
End Sub
Sub Image30_Click
Image30.color = 255,0,0
End Sub
Sub Image31_Click
Image31.color = 255,0,0
End Sub
Sub Image32_Tap
Image32.color = 255,0,0
End Sub

Sub Form1_Show

End Sub

Thanks for any help you can give me!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Can you upload your source code as a file?
BTW, you can change your code to:
B4X:
Sub App_Start
 Form1.Show
 For i = 2 to 32
  AddEvent("Image" & i, Click, "ImageClick")
 Next
End Sub

Sub ImageClick
 Sender.Color = cRed
End Sub
It is a bit shorter ;)
See this tutorial for more information: http://www.b4x.com/forum/showthread.php?t=907
 

neilnapier

Active Member
Licensed User
Longtime User
I'll try installing it... my pocket pc is normal 2003.

How would you do it so that it is single pixels (instead of boxes) that can be draged on?

EDIT: it works now... thanks! Now however when it is on my pocket pc the boaxes are a bit spaced out randomly.
 
Last edited:

neilnapier

Active Member
Licensed User
Longtime User
Have you ever heard of the game Falling Sand?

Something along the lines of that... (of course as I have just started to learn how to code so it will take a while) but that is what I hope to achieve.
 

agraham

Expert
Licensed User
Longtime User
If it is a Pocket PC 2002 or WM2003 (not SE) then you should install .Net CF 1.0 SP3.
Erel - I've remarked on this before. You seem still to be under the impression that all 2003SE based devices come with SP3. This is not so. The Axim X30, for one, comes with only SP2 in ROM and requires SP3 to be installed for B4PPC to operate correctly.
 

Cableguy

Expert
Licensed User
Longtime User
I wonder if its not only a "bringTo Front" issue...hum...
 

neilnapier

Active Member
Licensed User
Longtime User
OK... i'm doing better, but I have another glitch... when I press run it comes up

Object Reference not set to an instance of an object... with this code

B4X:
Sub App_Start
 BurningSand.Show
 For i = 1 to 75
  AddEvent("Image" & i, Click, "ImageClick")
 Next
End Sub

Sub ImageClick
 Sender.Color = cGray
End Sub

I don't want to send the file because it has images and I don't know if it saves it in the file itself.


EDIT: Nevermind sorted it!


How do you restart an app (eg having a restart button)
 
Last edited:
Top