Wish Publish/Subscribe Events...

Robert Maguire

Member
Licensed User
Longtime User
Apologies if this already exists and I have not been able to find it. I'm on limited bandwidth at the moment and I thought I would request this while I am thinking about it...

I'm still loving B4J and marvelling at how much I can do with so little code compared to other languages and GUI toolkits...

Having said that...one thing I miss from Python and wxPython is a library called 'PubSub'. Basically it allows two or more objects to set up a 'publish' and 'subscribe' event relationship. It is really useful for keeping multiple objects sychronised without caring about whether or not an object is open/active or how many instances of an object (or objects) exist.

The 'publishing' object simply publishes a 'message', e.g. Console.Publish("Start") and the 'subscribing' object has a 'listener' that accepts messages from a subscriber. When a message is published all the subscribers trigger a custom event for the message, e.g. Clock.Listen(Message as String). Based on the value of the Message you can decide what to do, e.g. "Start", "Stop", "Reset", etc...whatever Message values you decide. Using this example...one Console form can synchronise and control many Clock forms...

So my wish/question is...Does B4J already have a similar concept (that I have missed) or if not...how difficult would it be to add this concept to B4J?

Regards to All.
 
Top