B4J Tutorial [ABMaterial] Better Delegating the creation of complex components

alwaysbusy

Expert
Licensed User
Longtime User
I think some bubbling is in order! (not the champagne unfortunately)

I think it should be possible to set a parents EventHandler to be propagated to all its children so we can replace:
B4X:
' NEW PART: we set for each component that we want the handler of the events here to this class
 TopBarContainer.EventHandler = Me
 TopBarSubContainer.EventHandler = Me
 TopBarLogo.EventHandler = Me
 TopBarSearch.EventHandler = Me
 TopBarBtn1.EventHandler = Me
 TopBarBtn2.EventHandler = Me
 TopBarBtn3.EventHandler = Me

by:
B4X:
' NEW PART: we set the handler of the events here to this class, and all 'child' components too
 TopBarContainer.EventHandler = Me

and still catch the btn1_clicked in the class set by its parent, the TopBarcontainer. Else, it would be hard to keep track of when to set the EventHandler.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…