iOS Question Button not initialised (Sender)

Arf

Well-Known Member
Licensed User
Longtime User
I have a problem with one portion of my app. I've made a cut down project and attached it.
Basically there's 28 domino tiles laid, you can click on 3 to turn them over.
The first time I do so, I either get a crash with the message 'button not initialised', or if this doesn't happen everything seems to work OK but when the 3rd tile gets turned over, the rest of the tiles go dark for some reason.

I can't seem to make any progress on either of the 2 problems, if anyone is able to off any guidance I would much appreciate it.

Thanks

**File too big to upload because of image, so download it here instead:
http://www.filedropper.com/domino_1
**
 

Arf

Well-Known Member
Licensed User
Longtime User
I think the 'tiles going dark' problem is something to do with the way the designer has initialised the form, as it only ever happens the first time three tiles are flipped. No idea if the other problem is related or not.
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
Your SetBackroundImage sub is incorrect, try this:

B4X:
Sub SetBackgroundImage(b As Button, bmp As Bitmap, state As Int)
    Dim no As NativeObject = b
    no.RunMethod("setBackgroundImage:forState:", Array(bmp, state))
End Sub
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
Ok, I'll give that a try. I originally had that, but changed what I have now so that the bitmap gets set for all 3 states.
 
Upvote 0
Top