B4J Question [DSE] Procedural question

stevel05

Expert
Licensed User
Longtime User
Mainly @Erel , but feel free to offer an opinion.

I am writing a Designer script extension that intercepts the MouseEntered And MouseExited events. I then want to pass these back to the developer in the LayoutModule so that other actions could be taken if required. The events could be anything, but these are the ones I am using at the moment.

Should I

1) Use the same Sub signature, e.g. MouseEntered(EventData As MouseEvent) and explain that the sender will have to be obtained a different way. I think this would be my preference.
or
2) Use a different Sub Signature. e.g DSEMouseEntered(SourceView As B4XView, EventData As MouseEvent) and pass the sender/Source View as a parameter.
Or
3) Something else.

I think this is quite important as a point of design, and I don't want to go down the rabbit hole without consensus.
 
Last edited:

Sandman

Expert
Licensed User
Longtime User
I'm not saying it's good, but in theory you could do both variants at the same time, and let the consumer of the extension decide which one they like more and want to use. No need for configuration or anything, just call them both, if they exist.

With that said, I would probably go for option two if i made this extension. Perhaps with the prefix ("DSE") configurable in the init.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Perhaps with the prefix ("DSE") configurable in the init.
DSE would be part of the sub call, it would still have the EventName of the view as the prefix. Button1_DSEMouseEntered...
 
Upvote 0
Top