Other B4J - EVENTDATA - Something for the NEWBIES - like me.

AlexOfOz

Active Member
Licensed User
I can't help myself this time; I have to post up a simple HOW TO for the newbies. Most people on this forum, prepare to roll your eyes and sigh sadly.

For a long time now I've been trying to work out what the EventData is and how to use whatever it does. I've searched and scanned; I've read all of the manuals backwards and forwards, top to bottom and inside out. But nowhere that I can find is there a clear description, in simple words, of what the EventData is and how to access it. But now through sheer perseverance I've finally stumbled on to the answer. Firstly, to find out some information about MouseEvents, go to the documentation here - https://www.b4x.com/guides/B4XBasicLanguage/?page=82

Bet here's the magic that I couldn't find discussed anywhere. In order to extract the various data the event produces, you simply code it like this -

B4X:
Private Sub sample_MouseClicked (EventData As MouseEvent)

X1 = EventData.X

Endsub

(UPDATE - I have since realised that I did see the EventData.X mentioned in a post, but I didn't recognise what it was trying to tell me. I suppose that's a part of being a newbie)

I expected it would be eye rolling simple when I finally found it, but I didn't expect it to be that simple.

I hope this has been helpful for somebody else out there who has been tearing their hair out ..... like I was.

Alex
 
Last edited:

klaus

Expert
Licensed User
Longtime User
You may have a look at page 87 in the B4X Basic language booklet, there you find the explanation of the MouseEvent object.
EventData is the name of the returned MouseEvent object.

I have added an example in the next edition.
 
Upvote 0

AlexOfOz

Active Member
Licensed User
You may have a look at page 87 in the B4X Basic language booklet, there you find the explanation of the MouseEvent object.
EventData is the name of the returned MouseEvent object.

I have added an example in the next edition.
Thanks Klaus. It was your example that I was mentioning in my UPDATE above. As it turns out, the information is there and available, but the main point that I'm making is that it is virtually invisible for newbies who don't even know what they're looking for. But with my new found understanding I'm having a grand old time playing with my latest program, which uses a lot of EventData.X and EventData.Y
 
Upvote 0
Top