DrawBitmap events?

PenguinHero

Member
Licensed User
Longtime User
Hi All,

I'm learning to programmatically create my screens in B4A rather than use the designer.
I have started by writing a simple 2-D game and I've got to the point that I want to have some click events for the images I've placed on the screen.

The images use DrawBitmap, with one of the the canvases as the "owner" of the method I use to draw them. E.g. cvsMove.DrawBitmap(bmpArrowUp,Null,rect1)

I have had no problem working out how to add the click event for my one "real" button, a Quit button, but can't work out how to define a click event for the images.
Can I do this? Or can I only have click events for the panels that the buttons are drawn over? I guess I could create one panel per image, if that is what it takes?

Sorry if I haven't described this very well. Any suggestions appreciated.

Thanks.
 

PenguinHero

Member
Licensed User
Longtime User
Okay, I just found out I can draw images on buttons, so I'll switch to those (that I know how to create click events for) and stop using the images.

I'll see how that goes.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You can have Click events for almost all Views directly with B4A like
Panels, Buttons, Labels and ImageViews.
You need to enter an event name in the Initialize function.
And then use Sub EventName_Click.

Example:
B4X:
Dim imvTest As ImageView
'
imvTest.Initialize("imvTest")
'
'
Sub imvTest_Click

End Sub
Best regards.
 
Upvote 0
Top