B4J Tutorial [ABMaterial] PGMenuCard - A composite Component

Hi Guys,

In a project I've recently started working, I saw the need to create a "Custom" component... But since ABMaterial already uses this denomination for ABMCustomComponents, I decided to call this one a "CompositeComponent", mainly because it just uses already available components and makes them work as one.

This was created to be used as a MenuItem in a Grid Like Menu.
upload_2019-6-10_18-4-50.png


It is Highly customizable, and has one event... "Click"...
BUT, in order to be able to catch this event, some changes need to be done to the Page_ParseEvent;
B4X:
    If eventName = "beforeunload" Then
        Log("preparing for url refresh")
        ABM.RemoveMeFromCache(ABMShared.CachedPages, ABMPageId)
        Return
    else If eventName = "page_rowclicked" Then '# This is the block that needs to be added
        Dim MenuItemName As String = Params.Get("target") '#
        If SubExists(Me, MenuItemName & "_Clicked") Then '#
            CallSub(Me, MenuItemName & "_Clicked") '#
        Else'#
            LogError(MenuItemName & "_Clicked Not Found") '#
        End If '#
    End If

This is due to the fact that the Click event is being fired by a CELL and that at page level is cannot be "individualized"... BUT it can be filtered!

I have Commented the Subs as accurately as possible, and it should be easy enough to use...

I leave you with the Code Module, and will gladly answer any questions, and/or requests...
More CompositeComponents will surely follow...
 

Attachments

  • PGMenuCard.bas
    6.3 KB · Views: 501
Top